是否有Wordnet synset ID的规则?

时间:2018-02-16 06:15:17

标签: wordnet imagenet

我是Imagenet和Wordnet数据库的新手。我试图更粗略地重新分类Imagenet的图像和类别(例如' plant',' fish' fish' people',...)。 / p>

据我所知,图片可以在http://www.image-net.org/synset?wnid=[wnid]下载,而this file可以将同义词ID映射到相应的名词,但是有没有规定ID的规则(例如,每个数字都是ID是指某个类别还是子类别?)。

2 个答案:

答案 0 :(得分:2)

截至 2021 年 3 月 11 日,Imagenet 已公开声明:

<块引用>

新网站更简单;我们删除了相关或过时的函数,以专注于核心用例——使用户能够下载数据,包括完整的 ImageNet 数据集和 ImageNet 大规模视觉识别挑战赛 (ILSVRC)。 Source

这意味着任何使用所谓的“官方文档”来解析和搜索 imagenet 的服务现在都需要使用 nltk(与上面的海报答案相反)。

这是在我的服务开始返回所有 404 后提交帮助台票证后才得到确认的:

Begin forwarded message:

From: ImageNet Support <imagenet.help.desk@gmail.com>
Subject: Re: wordnet api
Date: March 16, 2021 at 11:21:37 AM EDT
To: Aaron Soellinger <me@me>

Unfortunately we have updated the website and do not maintain these APIs any more. Any URLs from the old website may become invalid if they are not on the new website. For your use case, a workaround may be to query the WordNet hierarchy, e.g., by using the WordNet NLTK interface. 

On Tue, Mar 16, 2021 at 11:18 AM Aaron Soellinger <me@me> wrote:
below:

ss = 'http://www.image-net.org/synset?wnid={wnid}'
hyp = 'http://www.image-net.org/api/text/wordnet.structure.hyponym?wnid={wnid}'
word = 'http://www.image-net.org/api/text/wordnet.synset.getwords?wnid={wnid}'
mapg = 'http://www.image-net.org/api/text/imagenet.synset.geturls.getmapping?wnid={wnid}'
urlf = 'http://www.image-net.org/api/text/imagenet.synset.geturls?wnid={wnid}'

On Mar 16, 2021, at 11:17 AM, ImageNet Support <imagenet.help.desk@gmail.com> wrote:

Hello Aaron,

What is the URL of the API?

Best, 

On Tue, Mar 16, 2021 at 8:15 AM Aaron Soellinger <me> wrote:
Hi,

I was using the wordnet api found at image-net.org/api ..  I have noticed that it no longer works.  All my links return 404s. 

Can you help?

—aaron

所以,是的,nltk 是。

答案 1 :(得分:1)

正如official API documentation所说,wnid是ImageNet中的标识而不是nltk。您可以根据API文档中的 ImageNet和WordNet之间的映射将单词映射到wnid。

  

要唯一标识一个同义词集,我们使用“ WordNet ID”(wnid),它是POS(即语音的一部分)和WordNet的SYNSET OFFSET的组合。

首先,在nltk中获取同义词集和偏移量:

from nltk.corpus import wordnet as wn

plant_list = wn.synsets('plant')
# plant_list is: [Synset('plant.n.01'), Synset('plant.n.02'), Synset('plant.n.03'), Synset('plant.n.04'), Synset('plant.v.01'), Synset('implant.v.01'), Synset('establish.v.02'), Synset('plant.v.04'), Synset('plant.v.05'), Synset('plant.v.06')]

offset = plant_list[0].offset()

其次,连接POS和偏移量

由于ImageNet仅考虑名词,因此只需在plant_list中选择名词同义词集,然后将wnid = "n{:08d}".format(offset)连接起来即可得到wnid

由于有一个同义词集列表,您将获得几个wnid的“植物”。