【问题标题】:Are there any rules of Wordnet synset ID?Wordnet 同义词集 ID 有什么规则吗?
【发布时间】:2018-07-27 00:38:15
【问题描述】:

我是 Imagenet 和 Wordnet 数据库的新手。我正在尝试更粗略地重新分类 Imagenet 的图像和类别(例如“植物”、“鱼”、“人”……)。

我知道图像可以在http://www.image-net.org/synset?wnid=[wnid] 下载,this file 将同义词集 ID 映射到相应的名词,但是是否有任何管理 ID 的规则(例如,ID 的每个数字是否意味着一些类别或子类别?)。

【问题讨论】:

    标签: wordnet imagenet


    【解决方案1】:

    截至 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 是。

    【讨论】:

      【解决方案2】:

      正如official API documentation 所说,wnid 是 ImageNet 中的标识,而不是 nltk。您可以根据 API 文档中的 ImageNet 与 WordNet 之间的映射 将 word 映射到 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 和 offset 拼接起来

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

      因为有一个同义词列表,你会得到几个wnid 'plant'。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-09-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多