简体   繁体   English

是否有任何Python NLP工具来找出可以解析句子的方式?

[英]Are there any Python NLP tools to figure out how many ways a sentence can be parsed?

I want to be able to measure ambiguity of a sentence, and my current my idea to do so is by measuring how many ways a sentence can be parsed. 我希望能够衡量一个句子的歧义性,而我目前的想法是通过衡量一个句子可以解析的方式。 For example, the sentence "Fruit flies like a banana" can have to interpretations. 例如,句子“水果像香蕉一样飞”可能需要解释。

So far I have tried using the Stanford Parser, but it only interpreted each sentence in one way. 到目前为止,我已经尝试使用Stanford Parser,但它仅以一种方式解释了每个句子。 My other idea was to measure how many different parts of speech each word in a sentence could mean, but each POS tagger I found only marked each word with 1 tag even when it could be multiple. 我的另一个想法是测量一个句子中每个单词可能意味着多少个不同的词性,但是我发现每个POS标记器仅用1个标记来标记每个单词,即使它可能是多个。

Are there are tools to do either? 有没有可以做的工具?

From the Stanford Parser FAQ page , hope it helps: 希望在Stanford Parser FAQ页面上有所帮助:

Can I obtain multiple parse trees for a single input sentence? 我可以为单个输入语句获取多个分析树吗?

Yes, for the PCFG parser (only). 是的,对于PCFG解析器(仅)。 With a PCFG parser, you can give the option -printPCFGkBest n and it will print the n highest-scoring parses for a sentence. 使用PCFG解析器,您可以给-printPCFGkBest n选项,它将为句子打印n个得分最高的解析器。 They can be printed either as phrase structure trees or as typed dependencies in the usual way via the -outputFormat option, and each receives a score (log probability). 它们可以通过-outputFormat选项以通常的方式打印为短语结构树或类型化的依存关系,并且每一个都获得一个分数(对数概率)。 The k best parses are extracted efficiently using the algorithm of Huang and Chiang (2005). 使用Huang和Chiang(2005)的算法可以有效地提取k最佳解析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我试图弄清楚如何计算在Python的字符串句子中字母大写的次数 - I'm trying to figure out how to count how many times a letter is capitalized in a string sentence in Python 如何查找NLP中的句子是否带有情感? - How to find if there is any emotion attached with a sentence in NLP? 尝试使用 Python 将解析的数据导出到 CSV 文件,但我不知道如何导出超过一行 - Attempting to export parsed data to CSV file with Python and I can't figure out how to export more than one row 在python中导入,有几种方法可以完成? - Importing in python, how many ways can it be done? 找出:给定句子中一个字符中出现了多少个单词:PYTHON - find out: In how many word a character is present in a given Sentence: PYTHON 无法弄清楚如何限制我的python游戏中可以按下的键数 - Cant figure out how to limit how many keys can pressed in my python game 使用 NLP 工具对句子进行联合切分 - Joint segmentation of the sentence using NLP tools 如何找出python引发了多少个异常 - How to figure out how many exceptions raised python 任何人都可以使用python帮助解决这个问题? - can any one help figure this out using python? 放入一句话后如何计算票的分类? (Python/自然语言处理) - How to calculate ticket classification after putting in a sentence? (Python/NLP)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM