0
Tree tree = sentence.get(TreeCoreAnnotations.TreeAnnotation.class);
      TreebankLanguagePack tlp = new PennTreebankLanguagePack();
      GrammaticalStructureFactory gsf = tlp.grammaticalStructureFactory();
      GrammaticalStructure gs = gsf.newGrammaticalStructure(tree);
      Collection<TypedDependency> td = gs.typedDependenciesCollapsedTree();
      System.out.println(td);
      Object[] list = td.toArray();
      TypedDependency typedDependency;
      for (Object object : list)
      {
        typedDependency = (TypedDependency) object;
        System.out.println(typedDependency.reln()+ " \t "+typedDependency.dep().word()+ " \t "+typedDependency.gov().word()+ " \n ");
      }

这是代码。正确生成类型化的依赖项。有没有办法以引理形式打印那些类型化的依赖对象?

4

1 回答 1

0

改变:

typedDependency.dep().word()

至:

typedDependency.dep().lemma()

你应该得到你所追求的!

于 2016-03-21T10:22:55.067 回答