Comments (4)
from wn.
@rudaoshi, to add to what @fcbond said, in Wn you can use the ili
member of a synset to see equivalent synsets across versions or even across lexicons for another language:
>>> import wn
>>> oewn = wn.Wordnet('oewn')
>>> wn30 = wn.Wordnet('omw-en')
>>> oewn.synsets('penumbra')[0].ili
ILI('i110430')
>>> wn30.synsets('penumbra')[0].ili
ILI('i110430')
>>> wn30.synsets(ili='i110430')[0].lemmas()
['penumbra']
>>> wnja = wn.Wordnet('omw-ja')
>>> wnja.synsets(ili='i110430')[0].lemmas()
['半影']
For the omw-en
lexicons (which are directly converted from the Princeton WordNet with very few changes), the sensekeys are available as the identifier
metadata of senses, but these are not available for other lexicons:
>>> wn30.senses('penumbra')[0].metadata()
{'identifier': 'penumbra%1:26:00::'}
>>> oewn.senses('penumbra')[0].metadata()
{}
>>> wnja.senses('半影')[0].metadata()
{}
from wn.
Thanks @goodmami and @fcbond . I did not understand this correctly before, but now, I think I start to get a more accurate picture of the implicit "mapping" in Wn. Actually, it seems that Wn does no mapping by itself, but loads resources that were previously mapped to ILI.
This mapping was done by external projects: OMW mapped the multilingual wordnets using the ili-map-pwn30.tab file from CILI-1.0, while OEWN used the corresponding pwn31 mapping.
Joining these mappings gives an intersection of 117583 identifiers, while the recall in OEWN 2021 is only 117441.
import wn
def ili_loss(wnstring1, wnstring2):
# WN 1:
wn1 = wn.Wordnet(wnstring1)
v1 = wn1.lexicons()
i1 = wn1.ilis()
n1 = len(i1)
print(f"{v1}: {n1} synsets")
# WN 2:
wn2 = wn.Wordnet(wnstring2)
v2 = wn2.lexicons()
i2 = wn2.ilis()
n2 = len(i2)
print(f"{v2}: {n2} synsets")
# Intersection:
ii = set(i1).intersection(i2)
ni = len(ii)
print(f"Intersection: {ni} synsets")
loss = n1 - ni
pct = 100 * loss/n1
print(f"Loss: {loss} synsets ({round(pct,2)})%")
ili_loss('omw-en', 'oewn')
[<Lexicon omw-en:1.4 [en]>]: 117659 synsets
[<Lexicon oewn:2021 [en]>]: 120039 synsets
Intersection: 117441 synsets
Loss: 218 synsets (0.19)%
ili_loss('omw-ja', 'oewn')
[<Lexicon omw-ja:1.4 [ja]>]: 57184 synsets
[<Lexicon oewn:2021 [en]>]: 120039 synsets
Intersection: 57076 synsets
Loss: 108 synsets (0.19)%
ili_loss('omw-arb', 'oewn')
[<Lexicon omw-arb:1.4 [arb]>]: 9916 synsets
[<Lexicon oewn:2021 [en]>]: 120039 synsets
Intersection: 9887 synsets
Loss: 29 synsets (0.29)%
I suppose that a part (though not all) of this difference can be attributed to #179.
from wn.
It seems like the original question has been answered.
from wn.
Related Issues (20)
- 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
- 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
- pyproject.toml: Fix ruff rules in tool.ruff.ignore
- Update Python versions, 3.8 to 3.12
- Add OEWN 2023 to index
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.