germanetpy.synset¶
Classes
|
This Enum class contains the conceptual relations (short: ConRel) that synsets can have to other synsets. |
|
This class holds a Synset object. |
|
This Enum class contains the three part-of-speech tags (WortCategory), a Synset can have in GermaNet. |
|
This Enum class contains the semantic wordclasses / semantic fields a Synset can have in GermaNet. |
|
defaultdict(default_factory=None, /, [...]) --> dict with default factory |
- class germanetpy.synset.ConRel(*args: Any, **kwargs: Any)[source]¶
Bases:
EnumThis Enum class contains the conceptual relations (short: ConRel) that synsets can have to other synsets. For a description of each relation look at https://uni-tuebingen.de/en/142846
- has_hypernym = 1¶
- has_hyponym = 2¶
- has_component_meronym = 3¶
- has_component_holonym = 4¶
- has_member_meronym = 5¶
- has_member_holonym = 6¶
- has_substance_meronym = 7¶
- has_substance_holonym = 8¶
- has_portion_meronym = 9¶
- has_portion_holonym = 10¶
- entails = 11¶
- is_entailed_by = 12¶
- causes = 14¶
- class germanetpy.synset.WordCategory(*args: Any, **kwargs: Any)[source]¶
Bases:
EnumThis Enum class contains the three part-of-speech tags (WortCategory), a Synset can have in GermaNet. adj = adjective, nomen = noun, verben = verb
- adj = 1¶
- nomen = 2¶
- verben = 3¶
- static get_possible_word_classes(word_category) set[source]¶
Each wor category can only occur with a specific set of word classes.
- Parameters:
word_category (WordCategory) – The word category
- Returns:
The set of word classes that occur with the given word category
- class germanetpy.synset.WordClass(*args: Any, **kwargs: Any)[source]¶
Bases:
EnumThis Enum class contains the semantic wordclasses / semantic fields a Synset can have in GermaNet. For a detailed description see: http://www.sfs.uni-tuebingen.de/GermaNet/germanet_structure.shtml#Tops
- Allgemein = 1¶
- Bewegung = 2¶
- Gefuehl = 3¶
- Geist = 4¶
- Gesellschaft = 5¶
- Koerper = 6¶
- Menge = 7¶
- natPhaenomen = 8¶
- Ort = 9¶
- Pertonym = 10¶
- Perzeption = 11¶
- privativ = 12¶
- Relation = 13¶
- Substanz = 14¶
- Verhalten = 15¶
- Zeit = 16¶
- Artefakt = 17¶
- Attribut = 18¶
- Besitz = 19¶
- Form = 20¶
- Geschehen = 21¶
- Gruppe = 22¶
- Kognition = 23¶
- Kommunikation = 24¶
- Mensch = 25¶
- Motiv = 26¶
- Nahrung = 27¶
- natGegenstand = 28¶
- Pflanze = 29¶
- Tier = 30¶
- Tops = 31¶
- Koerperfunktion = 32¶
- Konkurrenz = 33¶
- Kontakt = 34¶
- Lokation = 35¶
- Schoepfung = 36¶
- Veraenderung = 37¶
- Verbrauch = 38¶
- class germanetpy.synset.Synset(id: str, word_category: WordCategory, word_class: WordClass)[source]¶
Bases:
objectThis class holds a Synset object. A synset in GermaNet contains several lexical units and holds specific relations to other synsets, for example a synset can have hypernyms or hyponyms.
- add_lexunit(unit)[source]¶
Adds a lexical unit that part of this synset to the list of lexical units
- Parameters:
unit (Lexunit) – The lexUnit object to be added
- is_root() bool[source]¶
- Returns:
True if this Synset is the root of the Graph (= has no hypernyms), otherwise false
- is_leaf() bool[source]¶
- Returns:
True if this Synset is a leaf of the Graph (= has no hyponyms), otherwise false
- hypernym_paths() list[source]¶
This method iterates recursively through the hypernyms of this synset to get all paths that connect this synset with the root node. a path is complete if it ends with the root node. all possible paths are returned. each path is a list of nodes.
- Returns:
A list of lists, each lists contains a node sequence connecting this synset with the root node
- all_hypernyms() set[source]¶
This method extracts all hypernyms for this synset (the transitive closure for this synset)
- Returns:
a set, containing all possible hypernym nodes. it is empty if the current synset is the root node
- hyponym_paths() list[source]¶
This method iterates recursively through the hyponyms of this synset to get all paths that connect this synset with a leaf node. A path is complete if it ends with a leaf node. All possible paths are returned. Each path is a list of nodes.
- Returns:
A list of lists, each lists contains a node sequence connecting this synset with a leaf node
- all_hyponyms() set[source]¶
This method returns all possible hyponyms of this synset.
- Returns:
[set(Synset)] A set of synset nodes, each constitutes a hyponym of the current synset.
- shortest_path_to_root() list[source]¶
This method returns the shortest path to the root node.
- Returns:
[list(Synset)] shortest path to the root node.
- common_hypernyms(other) set[source]¶
Given another synset, this method computes shared hypernyms
- Parameters:
other (Synset) – another synset object
- Returns:
a set of synset nodes, that denotes the shared hypernyms between this synset and the given one.
- min_depth() int[source]¶
- Returns:
The length of the shortest hypernym path from this synset to the root.
- shortest_path_distance(other) int[source]¶
Returns the distance of the shortest path linking the two synsets (if one exists). If a node is compared with itself 0 is returned. The distance is denoted by the number of edges that exist in the shortest path.
- Parameters:
other (Synset) – The Synset to which the shortest path will be found.
- Returns:
The number of edges in the shortest path connecting the two nodes, or None if no path exists.
- shortest_path(other) list[source]¶
Returns the shortest possible sequence of synset nodes that are traversed from this synset to a given other synset. If there are several shortest sequences, all of then are returned.
- Parameters:
other (Synset) – A synset the path should be computed to
- Returns:
A list of lists, each list containing the sequence of nodes traversed from this synset to the given other synset.
- shortest_path_to_hypernym(hypernym) list[source]¶
The shortest path between this synset and the given hypernym. Asserts that the given other synset is a real hypernym of the current synset.
- Parameters:
hypernym (Synset) – a synset, denoting the hypernym the shortest path should be computed to
- Returns:
a list of lists, each list storing the shortest sequence of synset nodes traversed from self to the given hypernym
- lowest_common_subsumer(other) set[source]¶
Extract the lowes common subsumer(s) / lowest common ancestor(s) of the current synset and a given one.
- Parameters:
other (Synset) – Another synset object the LCS should be computed to.
- Returns:
a set, containing one or several synset objects, being the LCS between the current synset and the given one.
- get_distances_hypernym_dic() dict[source]¶
For each hypernym, store the shortest distance between the current synset and its hypernym.
- Returns:
A dictionary containing all hypernyms of this synset as keys and the corresponding distances as values.
- property id¶
- property word_category¶
- property word_class¶
- property paraphrase¶
- property lexunits¶
- property relations¶
- property incoming_relations¶
- property direct_hypernyms¶
- property direct_hyponyms¶