Comments (5)
from wn.
This is odd. I suspect the Sense.synset()
method is not creating a synset object in the same way as via the Wordnet.synsets()
method, and then the hypernym_paths()
method attempts to expand through all installed wordnets. If so, then it should be an easy fix.
edit: here's a shorter MWE:
import wn
en = wn.Wordnet('omw-en:1.4')
en.sense('omw-en-beast-00015388-n').synset().hypernym_paths()
from wn.
Looks like my guess was correct. Here is Sense.synset()
:
Lines 896 to 905 in a832a63
Note that it calls the module function wn.synset()
, without any limits on the lexicons. The resulting, unconstrained synset will then use any installed lexicon to look for expanded relations on subsequent operations. It would be better to construct a Synset
like how Wordnet.synset()
does:
Lines 1156 to 1162 in a832a63
But the lexicon_rowids
constraint on the call to find_synsets
would need to be filled out. If a Wordnet
object was used to get the sense, it would just be self._wordnet._lexicon_ids
, but not if the query was done in "default mode" (which I thought was documented, but now I don't see it in the docs; see #92 (comment)). Luckily there's a non-public convenience method for this:
Lines 266 to 274 in a832a63
Secondly, the wordnet object of the sense (accessible via the _wordnet
attribute) needs to be passed in the Synset
constructor instead of just self
.
Finally, it looks like Sense.word()
has the same issue.
I'm going to assign this to you, @fcbond. If that's ok, please submit a PR and I'll look it over. If not, I can do it.
from wn.
@fcbond just checking in. Do you think you can do this, or shall I?
from wn.
The synset issue was apparently resolved in #170. Sense.word()
still has the same problem, though.
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
- 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
- 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.