def main(unused_argv):
  analyses = analyze.surface_form(FLAGS.word)

  if analyses:
    print(f"Morphological analyses for the word '{FLAGS.word}':")
    for analysis in analyses:
      print(analysis)
  else:
    print(f"'{FLAGS.word}' is not accepted as a Turkish word")
예제 #2
0
def _gather_analyses(word_form: str) -> _AnalysisResult:
    """Gathers generated morphological analysis strings for a word form."""
    with_proper = analyze.surface_form(word_form)
    without_proper = analyze.surface_form(word_form, use_proper_feature=False)
    return word_form, with_proper, without_proper
def _analyze(token: str) -> Generator[analysis_pb2.Analysis, None, None]:
    human_readables = analyze.surface_form(token, use_proper_feature=False)
    yield from map(decompose.human_readable_analysis, human_readables)
예제 #4
0
 def test_failure(self, surface_form):
     actual = analyze.surface_form(surface_form)
     self.assertListEqual([], actual)
예제 #5
0
 def test_success(self, surface_form, expected, use_proper_feature=True):
     actual = analyze.surface_form(surface_form,
                                   use_proper_feature=use_proper_feature)
     self.assertListEqual(expected, actual)