Python LMF library
 All Classes Namespaces Files Functions Variables
Functions
pylmflib.pylmflib.input.xml_lmf Namespace Reference

Functions

def compute_name
 Compute attribute/module name from object name as follows: 'ObjectName' attribute/module name is 'object_name'. More...
 
def factory
 This function is an object factory. More...
 
def xml_lmf_read
 Read an XML LMF file. More...
 
def get_sub_elements
 This function recursively parses the given XML element and creates corresponding LMF instances with their attributes. More...
 

Function Documentation

def pylmflib.pylmflib.input.xml_lmf.compute_name (   object_name)

Compute attribute/module name from object name as follows: 'ObjectName' attribute/module name is 'object_name'.

Parameters
object_nameString containing name of the object, e.g. 'LexicalEntry'.
Returns
The corresponding attribute/module name, e.g. 'lexical_entry'.

Definition at line 9 of file xml_lmf.py.

def pylmflib.pylmflib.input.xml_lmf.factory (   object_name,
  attributes 
)

This function is an object factory.

Indeed, from an object name and its attributes, it creates a Python object and sets its attributes.

Parameters
object_nameA Python string containing the object name, for instance 'LexicalEntry'.
attributesA Python dictionary containing pairs of attribute name (as a Python string) and value, for instance {'partOfSpeech': 'n'}.

Definition at line 24 of file xml_lmf.py.

def pylmflib.pylmflib.input.xml_lmf.get_sub_elements (   instance,
  element 
)

This function recursively parses the given XML element and creates corresponding LMF instances with their attributes.

Parameters
instanceAn LMF object instance.
elementAn XML element.

Definition at line 72 of file xml_lmf.py.

def pylmflib.pylmflib.input.xml_lmf.xml_lmf_read (   filename)

Read an XML LMF file.

Parameters
filenameThe name of the XML LMF file to read with full path, for instance 'user/input.xml'.
Returns
A Lexical Resource instance containing all lexicons.

Definition at line 60 of file xml_lmf.py.