class documentation

class WordNetSynsetID(SynsetID):

View In Hierarchy

A resource identifier with the specified WordNet synset id.

Examples of WordNetSynsetID:

    rid = WordNetSynsetID('wn:06879521n')
Method __init__ init method
Method to_version Obtain a list of WordNetSynsetIDs corresponding to this WordNetSynsetID in the input WordNetVersion.
Instance Variable version WordNet version.
Instance Variable version_mapping Cross-version mapping.
Property is_valid True if the SynsetID is valid, False otherwise
Method _check_prefix_BS check the prefix and return a babel sense source version
Method _check_prefix_WN check the prefix and return a wordnet version
Constant _ID_LENGTH ID string length (int).
Constant _ID_PREFIX The WordNet offset prefix (str).
Constant _OEWN_ID_LENGTH ID lenght for OEWN
Constant _OEWN_ID_PREFIX The Open English WordNet offset prefix
Constant _WN2020_ID_LENGTH ID lenght for WN2020
Constant _WN2020_ID_PREFIX The WordNet 2020 offset prefix

Inherited from SynsetID:

Instance Variable pos the POS
Property simple_offset The offset without prefix (e.g. `wn:` or `bn:`).

Inherited from ResourceID (via SynsetID):

Method to_synsets Convert the ID to a collection of BabelSynsets.
Instance Variable id ID of a ResourceID.
Instance Variable language Language of the resource ID, if available.
Instance Variable source Source of the resource ID.
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __lt__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
def __init__(self, id_str, version=None, mapping=None):

init method

Parameters
id_str:strThe synset ID string.
version:Optional[WordNetVersion]The WordNet version (default WordNetVersion.WN_30).
mapping:Optional[Dict[WordNetVersion, List[str]]]Cross-version mapping (default None).
Raises
InvalidSynsetIDErrorRaised if the synset ID is invalid.
def to_version(self, target_version):

Obtain a list of WordNetSynsetIDs corresponding to this WordNetSynsetID in the input WordNetVersion.

Parameters
target_version:WordNetVersionThe target version to convert to.
Returns
List[WordNetSynsetID]Corresponding IDs.
version: WordNetVersion =

WordNet version.

version_mapping: Dict[WordNetVersion, List[str]] =

Cross-version mapping.

@property
is_valid: bool =

True if the SynsetID is valid, False otherwise

Returns
boolTrue or False
def _check_prefix_BS(self, prefix):

check the prefix and return a babel sense source version

Parameters
prefix:strthe prefix to check
Returns
BabelSenseSourcea BabelSenseSource
def _check_prefix_WN(self, prefix):

check the prefix and return a wordnet version

Parameters
prefix:strthe prefix to check
Returns
WordNetVersiona WordNetVersion
_ID_LENGTH: int =

ID string length (int).

Value
12
_ID_PREFIX: str =

The WordNet offset prefix (str).

Value
'wn:'
_OEWN_ID_LENGTH: int =

ID lenght for OEWN

Value
14
_OEWN_ID_PREFIX: str =

The Open English WordNet offset prefix

Value
'oewn:'
_WN2020_ID_LENGTH: int =

ID lenght for WN2020

Value
16
_WN2020_ID_PREFIX: str =

The WordNet 2020 offset prefix

Value
'wn2020:'