Skip to main content
 首页 » 编程设计

python之如何在 wordnet 词典中添加新词

2025年01月19日9findumars

我正在尝试匹配两个句子并找出相似之处。

我的句子中的某些单词(名词)似乎没有出现在 wordnet 词典中。如何将它们添加到 wordnet 中?

请您参考如下方法:

在这里试试:https://sourceforge.net/projects/extjwnl/

extJWNL (Extended Java WordNet Library) is a Java API for creating, reading and updating dictionaries in WordNet format. extJWNL is an upgraded version of JWNL. The library features support for creating, editing and writing dictionaries; dictionary encodings, including UTF-8; Java generics; huge dictionaries; instance dictionaries and static singletone dictionary; Maven and more.

用于添加新意义的示例脚本位于 https://github.com/extjwnl/extjwnl/wiki/ewnUserManual#script-editing

goal%1:09:00:: -add -addword end -setgloss "the state of affairs that a plan ... achieve it; ""the ends justify the means""" 
goal%1:09:00:: -addptr content%1:09:00:: @ 
n#oxen -addexc ox 

然后使用 ewn -script filename 运行