Comments (1)
I'm going with the following (thanks for the suggestion, @fcbond):
Synset.translate()
andSense.translate()
return a list of Synset or Sense translations, respectively, through the Synset's ILIWord.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)
- Generalize glob-search for lexicon/project specifiers
- Syntactic behaviours not being properly added
- If you try to loop through senses first, hypernym_paths() hangs HOT 5
- Document "default mode" queries
- Missing Spanish definitions HOT 3
- antonyms in languages other than German and English HOT 5
- Support for PTB and Universal POS tags HOT 6
- If you create an entry with an ILIDefinition, but ill.id='' you lose the definition HOT 2
- Tracing back 'inferred' synsets to their reference lexicons HOT 3
- Stumped by multilingual relation traversal HOT 7
- Synset.relations() for some lexicons uses synset id as relation name
- Update Python versions HOT 2
- Is there any mapping between different English wordnet? HOT 4
- synset.relations fails with a KeyError HOT 3
- Merged synsets are lost in translation HOT 8
- SQLite objects created in a thread can only be used in that same thread HOT 3
- Add OEWN 2022 to index HOT 2
- Addition to NLTK migration guide w.r.t. offsets HOT 4
- Add a `conda` install option for `wn` on conda-forge channel HOT 5
- Allow contributors to self-assign issues with GitHub workflow HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wn.