当前位置: 首页>>代码示例>>Python>>正文


Python task_spec_pb2.TaskSpec方法代码示例

本文整理汇总了Python中syntaxnet.task_spec_pb2.TaskSpec方法的典型用法代码示例。如果您正苦于以下问题:Python task_spec_pb2.TaskSpec方法的具体用法?Python task_spec_pb2.TaskSpec怎么用?Python task_spec_pb2.TaskSpec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在syntaxnet.task_spec_pb2的用法示例。


在下文中一共展示了task_spec_pb2.TaskSpec方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testCreateLexiconContext

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def testCreateLexiconContext(self):
    expected_context = task_spec_pb2.TaskSpec()
    text_format.Parse(_EXPECTED_CONTEXT, expected_context)
    self.assertProtoEquals(
        lexicon.create_lexicon_context('/tmp'), expected_context) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:7,代码来源:lexicon_test.py

示例2: create_lexicon_context

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def create_lexicon_context(path):
  """Construct a SyntaxNet TaskContext file for standard lexical resources."""
  context = task_spec_pb2.TaskSpec()
  for name in [
      'word-map', 'tag-map', 'tag-to-category', 'lcword-map', 'category-map',
      'char-map', 'char-ngram-map', 'label-map', 'prefix-table', 'suffix-table'
  ]:
    context.input.add(name=name).part.add(file_pattern=os.path.join(path, name))
  return context 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:11,代码来源:lexicon.py

示例3: WriteContext

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def WriteContext(self, corpus_format):
    context = task_spec_pb2.TaskSpec()
    self.AddParameter('brain_parser_embedding_names', 'words;tags', context)
    self.AddParameter('brain_parser_features', 'input.token.word;input.tag',
                      context)
    self.AddInput('documents', self.corpus_file, corpus_format, context)
    for name in ('word-map', 'lcword-map', 'tag-map',
                 'category-map', 'label-map', 'prefix-table',
                 'suffix-table', 'tag-to-category', 'char-map',
                 'char-ngram-map'):
      self.AddInput(name, os.path.join(FLAGS.test_tmpdir, name), '', context)
    logging.info('Writing context to: %s', self.context_file)
    with open(self.context_file, 'w') as f:
      f.write(str(context)) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:16,代码来源:lexicon_builder_test.py

示例4: WriteContext

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def WriteContext(self, corpus_format):
    context = task_spec_pb2.TaskSpec()
    self.AddInput('documents', self.corpus_file, corpus_format, context)
    for name in ('word-map', 'lcword-map', 'tag-map', 'category-map',
                 'label-map', 'prefix-table', 'suffix-table',
                 'tag-to-category'):
      self.AddInput(name, os.path.join(FLAGS.test_tmpdir, name), '', context)
    logging.info('Writing context to: %s', self.context_file)
    with open(self.context_file, 'w') as f:
      f.write(str(context)) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:text_formats_test.py

示例5: RewriteContext

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def RewriteContext():
  context = task_spec_pb2.TaskSpec()
  with gfile.FastGFile(FLAGS.task_context, 'rb') as fin:
    text_format.Merge(fin.read(), context)
  for resource in context.input:
    if resource.creator == StageName():
      del resource.part[:]
      part = resource.part.add()
      part.file_pattern = os.path.join(OutputPath(resource.name))
  with gfile.FastGFile(OutputPath('context'), 'w') as fout:
    fout.write(str(context)) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:13,代码来源:parser_trainer.py

示例6: create_lexicon_context

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def create_lexicon_context(path):
  """Construct a SyntaxNet TaskContext file for standard lexical resources."""
  context = task_spec_pb2.TaskSpec()
  for name in [
      'word-map', 'tag-map', 'tag-to-category', 'lcword-map', 'category-map',
      'char-map', 'char-ngram-map', 'label-map', 'prefix-table', 'suffix-table',
      'known-word-map'
  ]:
    context.input.add(name=name).part.add(file_pattern=os.path.join(path, name))
  return context 
开发者ID:rky0930,项目名称:yolo_v2,代码行数:12,代码来源:lexicon.py

示例7: WriteContext

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def WriteContext(self, corpus_format):
    context = task_spec_pb2.TaskSpec()
    self.AddInput('documents', self.corpus_file, corpus_format, context)
    for name in ('word-map', 'lcword-map', 'tag-map',
                 'category-map', 'label-map', 'prefix-table',
                 'suffix-table', 'tag-to-category', 'char-map'):
      self.AddInput(name, os.path.join(FLAGS.test_tmpdir, name), '', context)
    logging.info('Writing context to: %s', self.context_file)
    with open(self.context_file, 'w') as f:
      f.write(str(context)) 
开发者ID:coderSkyChen,项目名称:Action_Recognition_Zoo,代码行数:12,代码来源:lexicon_builder_test.py

示例8: WriteContext

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def WriteContext(self, corpus_format):
    context = task_spec_pb2.TaskSpec()
    self.AddInput('documents', self.corpus_file, corpus_format, context)
    for name in ('word-map', 'lcword-map', 'tag-map',
                 'category-map', 'label-map', 'prefix-table',
                 'suffix-table', 'tag-to-category'):
      self.AddInput(name, os.path.join(FLAGS.test_tmpdir, name), '', context)
    logging.info('Writing context to: %s', self.context_file)
    with open(self.context_file, 'w') as f:
      f.write(str(context)) 
开发者ID:coderSkyChen,项目名称:Action_Recognition_Zoo,代码行数:12,代码来源:text_formats_test.py

示例9: RewriteContext

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def RewriteContext():
  context = task_spec_pb2.TaskSpec()
  with gfile.FastGFile(FLAGS.task_context) as fin:
    text_format.Merge(fin.read(), context)
  for resource in context.input:
    if resource.creator == StageName():
      del resource.part[:]
      part = resource.part.add()
      part.file_pattern = os.path.join(OutputPath(resource.name))
  with gfile.FastGFile(OutputPath('context'), 'w') as fout:
    fout.write(str(context)) 
开发者ID:coderSkyChen,项目名称:Action_Recognition_Zoo,代码行数:13,代码来源:parser_trainer.py

示例10: RewriteContext

# 需要导入模块: from syntaxnet import task_spec_pb2 [as 别名]
# 或者: from syntaxnet.task_spec_pb2 import TaskSpec [as 别名]
def RewriteContext(task_context):
  context = task_spec_pb2.TaskSpec()
  with gfile.FastGFile(task_context) as fin:
    text_format.Merge(fin.read(), context)
  for resource in context.input:
    for part in resource.part:
      if part.file_pattern != '-':
        part.file_pattern = os.path.join(FLAGS.resource_dir, part.file_pattern)
  with tempfile.NamedTemporaryFile(delete=False) as fout:
    fout.write(str(context))
    return fout.name 
开发者ID:coderSkyChen,项目名称:Action_Recognition_Zoo,代码行数:13,代码来源:parser_eval.py


注:本文中的syntaxnet.task_spec_pb2.TaskSpec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。