germanetpy package¶
Submodules¶
germanetpy.compoundInfo module¶
germanetpy.filterconfig module¶
germanetpy.frames module¶
-
class
germanetpy.frames.
Frames
(frames2lexunits: dict)[source]¶ Bases:
object
-
EXPLETIVE
= 'NE'¶
-
SUBJECT
= 'NN'¶
-
ACCOBJ
= 'AN'¶
-
DATOBJ
= 'DN'¶
-
GENOBJ
= 'GN'¶
-
PREPOBJ
= 'PP'¶
-
LOC
= 'BL'¶
-
DIR
= 'BD'¶
-
TEMP
= 'BT'¶
-
MAN
= 'BM'¶
-
INST
= 'BS'¶
-
CAUSE
= 'BC'¶
-
ROLE
= 'BR'¶
-
COM
= 'BO'¶
-
reflexives
= ['DR', 'AR']¶
-
extract_expletives
() → set[source]¶ This method extracts all verbs that can take expletives as an argument. Example: “[Es] regnet.”
Returns: A set of lexical units that stores all verbs as Lexunits that have the specified frame.
-
extract_accusative_complement
() → set[source]¶ This method returns all verbs that can take an accusative complement. Example: “Sie sieht [ihn]”
Returns: A set of lexical units that stores all verbs as Lexunits that have the specified frame.
-
extract_dative_complement
() → set[source]¶ This method returns all verbs that can take an dative complement. Example: “Sie schenkt [ihm] einen Hund.”
Returns: A set of lexical units that stores all verbs as Lexunits that have the specified frame.
-
extract_gentive_complement
() → set[source]¶ This method returns all verbs that can take an genetive complement. Example: “Ihre Eltern berauben sie [ihrer Freiheit].”
Returns: A set of lexical units that stores all verbs as Lexunits that have the specified frame.
-
extract_prepositional_complement
() → set[source]¶ This method returns all verbs that can take an prepositional complement. Example: “Die Kugel klackte [an die Fensterscheibe].”
Returns: A set of lexical units that stores all verbs as Lexunits that have the specified frame.
-
extract_reflexives
() → set[source]¶ This method returns all verbs that can take an reflexive complement. Example: “Sie wird [sich] rächen.”
Returns: A set of lexical units that stores all verbs as Lexunits that have the specified frame.
-
extract_adverbials
() → set[source]¶ This method returns all verbs that can take an adverbial complement. Example: “Sie wohnt [in einem Haus].”
Returns: A set of lexical units that stores all verbs as Lexunits that have the specified frame.
-
extract_transitives
() → set[source]¶ This method returns all transitive verbs. A transitive verb is any verb that can have objects.
Returns: A set of lexical units that stores all transitive verbs as Lexunits.
-
extract_intransitives
() → set[source]¶ This method returns all intransitive verbs. An intransitive verb is any verb that does not have objects.
Returns: A set of lexical units that stores all intransitive verbs as Lexunits.
-
extract_specific_complements
(complement: str) → set[source]¶ This method returns all verbs that can take a given complement. This is specified in the frames of a verb.
Param: complement : a syntactic complement (e.g NN for subject), the complements are specified as class variables of this class Returns: A set of lexical units that stores all verbs as Lexunits that can take the specified complement.
-
frames2verbs
¶
-
germanetpy.germanet module¶
germanetpy.icbased_similarity module¶
germanetpy.iliLoader module¶
-
germanetpy.iliLoader.
create_ili_record
(attributes, synonyms) → germanetpy.iliRecord.IliRecord[source]¶ Creates the ili record given the XML attributes.
Parameters: - attributes (xml attributes) – The XML attributes that contain the required information about the ili record.
- synonyms (list(String)) – A list of Strings, containing the synonyms of the ili record.
Returns: The ili record object
-
germanetpy.iliLoader.
load_ili
(germanet, tree)[source]¶ This method creates the ili record objects given a datafile and adds them to the GermaNet object and the corresponding lexical unit.
Parameters: - germanet (Germanet) – The GermaNet object
- tree (Element Tree) – The XML tree containing the data about the ili records
germanetpy.iliRecord module¶
germanetpy.lexunit module¶
germanetpy.longest_shortest_path module¶
-
germanetpy.longest_shortest_path.
get_overall_longest_shortest_distance
(germanet, category) -> (<class 'dict'>, <class 'int'>)[source]¶ Iterate trough the synsets of a given wordcategory. For each synset, extract all possible hypernyms and compute the shortest possible distance to each hypernym. From these distances, also store the longest possible shortest distance.
Parameters: - germanet (Germanet) – the germanet graph
- category (WordCategory) – the wordcategory
Returns: a dictionary with each synset and its longest shortest distance, the overall longest shortest distance
-
germanetpy.longest_shortest_path.
get_greatest_depth
(germanet, category) → int[source]¶ Iterate trough the synsets of a given word category. For each synset check the depth and return the greatest depth that has been seen.
Parameters: - germanet (Germanet) – the germanet graph
- category (WordCategory) – the wordcategory
Returns: the greatest depth for a given word category. The depth of a synset is defined by the shortest path length between the synset and the root node
-
germanetpy.longest_shortest_path.
get_longest_possible_shortest_distance
(germanet, wordcategory)[source]¶ set a maxdistcounter = 0 for each synset: get the corresponding longest shortest distance. if this plus the overall longest shortest distance is smaller than maxdistance:
continue with the next synset- if it is larger:
go trough each synset and get the corresponding longest shortest distance. if this plus the longest shortest distance of the synset of interest is smaller than maxdistance:
continue- else:
- compute the actual path distance and update the maxdistance if it is larger
Return type: Parameters: - wordcategory (WordCategory) – the wordcategory for which this maxlen should be computed
- germanet (Germanet) – the germanet graph
Returns: the longest possible shortest distance between two synsets of a specified wordcategory, the maximum depth
of any synset (lenght to the root) and a Tuple with two synsets that have the longest shortest distance