Python LMF library
 All Classes Namespaces Files Functions Variables
Functions
pylmflib.pylmflib.output.doc Namespace Reference

Functions

def file_read
 Read file contents. More...
 
def doc_write
 Write a document file. More...
 

Function Documentation

def pylmflib.pylmflib.output.doc.doc_write (   object,
  filename,
  introduction = None,
  lmf2doc = lmf_to_doc,
  items = lambda lexical_entry: lexical_entry.get_lexeme(),
  sort_order = None,
  paradigms = False,
  reverse = False 
)

Write a document file.

Parameters
objectThe LMF instance to convert into document output format.
filenameThe name of the document file to write with full path, for instance 'user/output.doc'.
introductionThe name of the text file with full path containing the introduction of the document, for instance 'user/config/introduction.txt'. Default value is None.
lmf2docA function giving the mapping from LMF representation information that must be written to docx commands, in a defined order. Default value is 'lmf_to_doc' function defined in 'pylmflib/config/doc.py'. Please refer to it as an example.
itemsLambda function giving the item to sort. Default value is 'lambda lexical_entry: lexical_entry.get_lexeme()', which means that the items to sort are lexemes.
sort_orderPython list. Default value is 'None', which means that the document output is alphabetically ordered.
paradigmsA boolean value to introduce paradigms in document or not.
reverseA boolean value to set if a reverse dictionary is wanted.

Definition at line 26 of file doc.py.

def pylmflib.pylmflib.output.doc.file_read (   filename)

Read file contents.

Parameters
filenameThe name of the file with full path containing information to read, for instance the text introduction of the document: 'user/config/introduction.txt'.
Returns
A Python string containing read information.

Definition at line 14 of file doc.py.