22

有人可以指出我可以将英语词典下载为 txt 或 xml 文件的位置。我正在为自己构建一个简单的应用程序,并寻找可以立即开始使用而无需学习复杂 API 的东西。

对同义词的支持会很好,那就是应该更容易检索特定单词的所有同义词。

如果字典能列出它们不同的单词的英式和美式拼写,那将是非常棒的。

即使它是小字典(几千字)也没关系,我只需要它用于一个小项目。

如果价格合理,而且字典易于使用,我什至愿意买一本——简单的 XML 会很棒。

请有任何指示。

4

4 回答 4

17

WordNet就是您想要的。它很大,包含超过十万个条目,并且可以免费使用。

但是,它不存储为 XML。要访问数据,您需要使用现有WordNet API之一作为您选择的语言。

使用 API 通常非常简单,所以我认为您不必担心“学习 (a) 复杂的 API”。例如,借用WordNet How to for the Python based Natural Language Toolkit (NLTK)

 >>> from nltk.corpus import wordnet
 >>> 
 >>> # Get All Synsets for 'dog'
 >>> # This is essentially all senses of the word in the db
 >>> wordnet.synsets('dog')
 [Synset('dog.n.01'), Synset('frump.n.01'), Synset('dog.n.03'), 
  Synset('cad.n.01'), Synset('frank.n.02'),Synset('pawl.n.01'), 
  Synset('andiron.n.01'), Synset('chase.v.01')]
 
 >>> # Get the definition and usage for the first synset
 >>> wn.synset('dog.n.01').definition
 'a member of the genus Canis (probably descended from the common 
 wolf) that has been domesticated by man since prehistoric times; 
 occurs in many breeds'
 >>> wn.synset('dog.n.01').examples
 ['the dog barked all night']

 >>> # Get antonyms for 'good'
 >>> wordnet.synset('good.a.01').lemmas[0].antonyms()
 [Lemma('bad.a.01.bad')]

 >>> # Get synonyms for the first noun sense of 'dog'
 >>> wordnet.synset('dog.n.01').lemmas
 [Lemma('dog.n.01.dog'), Lemma('dog.n.01.domestic_dog'), 
 Lemma('dog.n.01.Canis_familiaris')]

 >>> # Get synonyms for all senses of 'dog'
 >>> for synset in wordnet.synsets('dog'): print synset.lemmas
 [Lemma('dog.n.01.dog'), Lemma('dog.n.01.domestic_dog'), 
 Lemma('dog.n.01.Canis_familiaris')]
 ...
 [Lemma('frank.n.02.frank'), Lemma('frank.n.02.frankfurter'), 
 ...

虽然 WordNet 中存在美式英语偏见,但它支持英式拼写和用法。例如,您可以查找“color”,“lift”的同义词之一是“elevator.n.01”。

XML 注释

如果必须将数据表示为 XML,您可以轻松地使用其中一种 API 访问 WordNet 数据库并将其转换为 XML,例如,请参阅Thinking XML: Querying WordNet as XML

于 2010-04-19T17:55:39.670 回答
13

I know this question is quite old but I had problems myself for finding that as a txt file, so if anyone would be looking synonyms and antonyms txt file database the simplest yet very detailed try https://ia801407.us.archive.org/10/items/synonymsantonyms00ordwiala/synonymsantonyms00ordwiala_djvu.txt .

于 2015-02-17T14:27:54.023 回答
6

我过去使用过Roget 的词库。它在纯文本文件中具有同义词信息。还有一些 java 代码可以帮助您解析文本。

这些页面提供了一系列同义词词典/词汇资源的链接,其中一些可以免费下载。

http://www.w3.org/2001/sw/Europe/reports/thes/thes_links.html

http://www-a2k.is.tokushima-u.ac.jp/member/kita/NLP/lex.html

于 2010-04-21T17:55:52.500 回答
3

试试WordNet

于 2010-04-19T12:31:59.697 回答