Use Multilingual Wordnet Data from OMW with newer Wordnet versions #2889
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR complements #2860, by providing a compatibility mapping between any newer Wordnet version (starting with Wordnet 3.1), and the multilingual Wordnet data from nltk_data/corpora/omw, which uses synset offsets from Wordnet version 3.0.
Each Wordnet version uses different synset offsets as identifiers. However, sense keys are permanent across versions. So this PR reads the index.sense file that is provided with each Wordnet package, to automatically construct a mapping from Wordnet 3.0 to any newer Wordnet package, so that the package can be used to access multilingual Wordnet synsets.
The advantage of this approach is that there is no need to wait for hypothetical mappings to be developed by third parties.
Instead, any Wordnet package that adheres to the official Princeton format is supported out of the box. For example, with wordnet31, the attached testlangs.py.txt produces the following statistics:
This PR has also been tested with the newer Wordnet versions discussed in #2885.