如何使用Stanford解析器使用python提取功能

如何使用Stanford解析器使用python提取功能,python,nlp,svm,stanford-nlp,Python,Nlp,Svm,Stanford Nlp,我已经在我的项目中包括了斯坦福语法分析器 def parseToStanfordDependencies(self, sentence): tokens, tree = self.parse(sentence) standoffTokens = [standoffFromToken(sentence, token) for token in tokens] posTags = [token.ta

我已经在我的项目中包括了斯坦福语法分析器

def parseToStanfordDependencies(self, sentence):

        tokens, tree = self.parse(sentence)
        standoffTokens = [standoffFromToken(sentence, token)
                          for token in tokens]
        posTags = [token.tag() for token in tree.taggedYield()]
        print " ".join(["%s/%s" % (word.text, tag) for word, tag in zip(standoffTokens, posTags)])
        #print tree.taggedYield().toString(False)
        result = self.package.trees.EnglishGrammaticalStructure(tree)

        returnList = []
        for dependency in result.typedDependenciesCollapsedTree():

            govStandoff = standoffTokens[dependency.gov().index() - 1]
            depStandoff = standoffTokens[dependency.dep().index() - 1]

            returnList.append((str(dependency.reln()),
                               govStandoff,
                               depStandoff))

        return Dependencies(sentence, standoffTokens, posTags, returnList)
我正在用线性支持向量机进行文本分类。我试过了

from stanford_parser import parser

stanford_parser = parser.Parser()
print stanford_parser.parseToStanfordDependencies("This girl I met was your sister.")
然而,除了POS标记之外,我还想使用Stanford解析器来提取其他语法特征,比如产生式规则。我该怎么办?有人愿意帮助我吗?我是Python和自然语言处理的新手