germanetpy.germanet

Functions

load_ili(germanet, tree)

This method creates the ili record objects given a datafile and adds them to the GermaNet object and the corresponding lexical unit.

load_lexunits(germanet, tree)

Takes the XML tree and walks trough it to create the Lexunit objects.

load_relations(germanet, tree)

Loads the information about the related synsets ans lexunits from the data and adds the edges between the objects.

load_wiktionary(germanet, tree)

Given a XML tree this method initialized the wiktionary objects and adds them to the germanet object and the corresponding lexunits

parse_xml(datadir, f)

Parses an XML file and returns the XML tree

Classes

Frames(frames2lexunits)

Germanet(datadir[, add_ilirecords, ...])

defaultdict

defaultdict(default_factory=None, /, [...]) --> dict with default factory

class germanetpy.germanet.Germanet(datadir: str, add_ilirecords: bool = True, add_wiktionary: bool = True)[source]

Bases: object

get_synsets_by_orthform(form: str, ignorecase: bool = False) list[source]

This method returns a list of synsets that match the given input search string

Parameters:
  • form – a word that can be looked up in the GermaNet

  • ignorecase – whether the case of the word should be ignored (default = False)

Returns:

a list of synsets

get_synsets_by_wordcategory(category) list[source]

Returns a list of synsets that belong to the specified word category

Parameters:

category (WordCategory) – The word category of interest

Returns:

A list of Synsets that belong to the specified word category

get_synsets_by_wordclass(wordclass) list[source]

Returns a list of synsets that belong to the specified word class

Parameters:

wordclass (WordClass) – The word category of interest

Returns:

A list of Synsets that belong to the specified word class

get_synset_by_id(id: str)[source]

Returns a Synset by a specified identifier (if that exists, otherwise raises an Error)

Return type:

Synset

Parameters:

id – a Synset identifier

Returns:

The matching Synset object

get_lexunit_by_id(id: str)[source]

Returns a lexical unit by a specified identifier (if that exists, otherwise raises an Error)

Return type:

Lexunit

Parameters:

id – a Lexunit identifier

Returns:

The matching Lexunit object

get_lexunits_by_orthform(form: str, ignorecase: bool = False) list[source]

This method returns a list of lexical units that match the given input search string

Parameters:
  • form – a word that can be looked up in the GermaNet

  • ignorecase – whether the case of the word should be ignored (default = False)

Returns:

a list of lexical units that match the given input query

get_lexunits_by_wordclass(wordclass) list[source]

Returns a list of lexical units that belong to the specified word class

Parameters:

wordclass (WordClass) – The word category of interest

Returns:

A list of lexical units that belong to the specified word class

get_lexunits_by_wordcategory(category) list[source]

Returns a list of lexical units that belong to the specified word category

Parameters:

category (WordCategory) – The word category of interest

Returns:

A list of lexical units that belong to the specified word category

get_synsets_by_frame(frame: str) list[source]

Returns a list of Synsets that match a specified frame

Parameters:

frame – a frame that describes the argument structure of a verb (e.g. ‘NN.AN’ specifies that a verb can take a subject and accusative object as arguments.)

Returns:

a list of Synsets that match the given frame. If the frame is not valid an Assertion Error will be raised

property lexunits
property synsets
property orthform2lexid
property mainOrtform2lexid
property lowercasedform2lexid
property wordcat2lexid
property wordclass2lexid
property compounds
property frames2lexunits
property wiktionary_entries
property ili_records
property frames
property root
property datadir
property add_ilirecords
property add_wiktionary