Giter Club home page Giter Club logo

Comments (1)

goodmami avatar goodmami commented on May 28, 2024

I'm going with the following (thanks for the suggestion, @fcbond):

  • Synset.translate() and Sense.translate() return a list of Synset or Sense translations, respectively, through the Synset's ILI
  • Word.translate() returns a dict mapping a Sense to the list of Words that are translation of the sense
>>> wn.synsets('緑茶')[0].translate(lexicon='ewn:2020')
[Synset('ewn-07951392-n')]
>>> wn.senses('緑茶')[0].translate(lexicon='ewn:2020')
[Sense('ewn-green_tea-n-07951392-01')]
>>> wn.words('緑茶')[0].translate(lexicon='ewn:2020')
{Sense('wnja-07935152-n-33498'): [Word('ewn-green_tea-n')]}

One other problem was what to do with synsets without an ILI. Initially I thought of raising an error, since it's not the case that there are no translations in the resource, but that we cannot check because of the lack of ILI. But this wouldn't make sense for Word.translate() because there might be other senses whose synset does have an ILI and I wouldn't want the error to block those. So for this first implementation it will return an empty list for any sense/synset without any ILI, which is the same behavior as when there is an ILI but no entities in the target lexicon linked to the ILI. Users who care about the distinction would need to check the ILI themselves.

from wn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.