ims词义消歧工具的python包装(zhong和ng,2010)
pyims的Python项目详细描述
pyims
一个简单的python包装器,围绕ims(它是有意义的)词义消歧工具包,它集成了nltk的wordnet接口。需要单独下载ims,这需要一个工作的java安装。还需要下载wordnet的nltk。只有在Linux中测试过,可能在其他操作系统中不起作用。为Python3.6+构建
安装
首先,按照Section 3 of the IMS Readme中的说明将ims的组件安装到某个目录中;从here(步骤3.e)中将模型提取到与步骤3.b和3.c相同的目录中。然后,运行:
pip install pyims
用法
frompyimsimportPyIMSwsd=PyIMS("path/to/ims","modelsDirName")print(wsd.disambiguate("I am interested in the interest rates at the bank.",probs=True,synsets=False))# If probs=True, returns a list of (token, probability_distribution) tuples where probability_distribution is a map of lemma to its probability# If probs=False (default False), returns a list of (token, lemma) where lemma is the most probable word-sense in WordNet for the given token# If synsets=True, lemmas are replaced with the Synsets to which they belong# If synsets=False (default False), to access a lemma's synset, call lemma.synset()
参考文献
- 钟,智和吴,和头。2010年。这是有意义的:一个广泛覆盖的词义消歧系统的自由文本。《2010年美国公民自由联盟系统演示会议录》,第78-83页,瑞典乌普萨拉