germanetpy.synsetLoader

Functions

add_orth_forms(germanet, lexunit, ...)

Checks which orthform the tag contains, and adds it to the lexunit object.

convert_to_boolean(attribute)

Converts the given String into a boolean.

create_compound_info(child)

Creates a compound info object.

create_lexunit(germanet, attributes, ...)

Given the XML data, creates a Lexunit object.

get_attribute_element(attributes, element, enum)

Constructs an Emum object of a given attribute :rtype: FastEnum :type enum: FastEnum :type attributes: XML attributes :param attributes: XML attributes of a certain XML node :param elment: A String :param enum: The Enum object that should be initialized :return: The corresponding Enum object or None

get_attribute_element_without_enum(...)

Returns attribute value if attribute exists :type attributes: XML attributes :param attributes: XML attributes of a certain XML node :param elment: A String :return: The corresponding object or None

load_lexunits(germanet, tree)

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

Classes

CompoundCategory(*args, **kwargs)

This Enum represents the syntactic wordcategory a modifier of a compound can belong to.

CompoundInfo(modifier1, head[, modifier2, ...])

CompoundProperty(*args, **kwargs)

This Enum represents the properties a compound constituent can have.

LexRel(*args, **kwargs)

This enum represents the lexical relation (short: LexRel) that a Lexunit can have in GermaNet.

Lexunit(id, synset, sense, source, ...[, ...])

This class holds the lexical unit object of GermaNet.

Synset(id, word_category, word_class)

This class holds a Synset object.

WordCategory(*args, **kwargs)

This Enum class contains the three part-of-speech tags (WortCategory), a Synset can have in GermaNet.

WordClass(*args, **kwargs)

This Enum class contains the semantic wordclasses / semantic fields a Synset can have in GermaNet.

germanetpy.synsetLoader.get_attribute_element(attributes, element: str, enum)[source]

Constructs an Emum object of a given attribute :rtype: FastEnum :type enum: FastEnum :type attributes: XML attributes :param attributes: XML attributes of a certain XML node :param elment: A String :param enum: The Enum object that should be initialized :return: The corresponding Enum object or None

germanetpy.synsetLoader.get_attribute_element_without_enum(attributes, element: str)[source]

Returns attribute value if attribute exists :type attributes: XML attributes :param attributes: XML attributes of a certain XML node :param elment: A String :return: The corresponding object or None

germanetpy.synsetLoader.create_compound_info(child) CompoundInfo[source]

Creates a compound info object. This has a modifier (String) and a head (String). Each modifier and the head can have a property (CompoundProperty) and a category (CompoundCategory). :param child: the XML element :return: A CompoundInfo object

germanetpy.synsetLoader.load_lexunits(germanet, tree)[source]

Takes the XML tree and walks trough it to create the Lexunit objects. :type tree: Element Tree :type germanet: Germanet :param germanet: the germanet object :param tree: XML tree

germanetpy.synsetLoader.create_lexunit(germanet, attributes, lex_root, synset) Lexunit[source]

Given the XML data, creates a Lexunit object. :type attributes: XML attributes :type germanet: Germanet :param germanet: The germanet object. :param attributes: The XML attributes. :param lex_root: The XML root :param synset: the corresponding synset object :return: a lexical unit object

germanetpy.synsetLoader.add_orth_forms(germanet, lexunit: Lexunit, child_value: str, tag: str)[source]

Checks which orthform the tag contains, and adds it to the lexunit object. Adds the lexunit id to the corresponding dictionary.

Parameters:
  • germanet (Germanet) – The germanet object containing the Orthform variant dictionaries.

  • lexunit – the Lexunit object the Orthform variant needs to be added to

  • child_value – the value of the XML element that contains this Orthform variant

  • tag – the value of the XML tag specifying the type of Orthform variant