Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

WoWiBackend::WoWiBackend Class Reference

List of all members.

Public Member Functions

 __init__ (restr=None)
 get_sentence (permuted=False, structure='words', permtype='all', level=0)
 get_sentence_with_marked_const (permuted=False, structure='words', permtype='all', level=1, choices=[])
 get_sentence_with_replacements (permuted=False, structure='consts', permtype='all', level=1, choices=[], wrong=1, correct=1)
 check_permutation (origSentList, userSentList, permtype='all', level=0)
 check_description (node, valueDict)
 check_replacement (const, replConst)
 get_repl_solution (constNode, choices)
 get_perm_solution (sentList, permtype='all', level=0)
 get_descr_solution (node, detailed=True, printFeats=None)
 _check_and_repair_broken_const (termList)
 _check_movable (const)
 _check_np (npConst)
 _build_permuted_sent (termNodeList)

Detailed Description

The main backend class for WoWi (WortWirbler)


Member Function Documentation

WoWiBackend::WoWiBackend::__init__ restr  = None  ) 
 

Initializes the program by instatiating module Grammar Calls

WoWiBackend::WoWiBackend::_build_permuted_sent termNodeList   ) 
 

takes a list of switched (terminal) ConstNodes and builds the appropriate ConstNode sentence representation if successful: returns a tupel (True, new_sentence_root_node) if not: returns a tupel (False, old_termNodeList)

WoWiBackend::WoWiBackend::_check_and_repair_broken_const termList   ) 
 

takes a list of ConstNodes and checks whether their order doesn't break a constituent; tries to repair broken consts by switching termNodes with the same surface in the list; returns a tupel of 'True' and a (possibly altered) ConstNode list or a tupel of 'False' and the original ConstNode list, if it could not be repaired.

WoWiBackend::WoWiBackend::_check_movable const   ) 
 

takes a movable ConstNode (Satzteil) and checks whether it has a legal structure returns (True, '') if everything is okay or (False, message_string)

WoWiBackend::WoWiBackend::_check_np npConst   ) 
 

takes an np ConstNode and checks whether it has a legal structure returns: (True, '') if all is okay or (False, {'text': bad_np, 'errVal': 'surface_of_bad_np'})

WoWiBackend::WoWiBackend::check_description node  ,
valueDict 
 

takes a node and a Dict: {'name': ..., 'feats': {...}} NOTE: 'name' is obligatory, 'feats' not checks whether these fit the values of the node returns a message dictionary (structure see file conf_converter.py) NOTE: The value and key names *must* match the internal names!

WoWiBackend::WoWiBackend::check_permutation origSentList  ,
userSentList  ,
permtype  = 'all',
level  = 0
 

takes two sentLists (lists with ConstNodes) and tests whether they are legal permutations of each other; returns a message dict (structure see file conf_converter)

WoWiBackend::WoWiBackend::check_replacement const  ,
replConst 
 

checks whether a replConst is a legal replacement of const; returns a messageDict (structure see file conf_converter.py)

WoWiBackend::WoWiBackend::get_descr_solution node  ,
detailed  = True,
printFeats  = None
 

takes a node and a flag value returns message dict with the grammatical description of the node (with features, if flag is set, only nodetype otherwise) if printFeats is set, only the values of the feats in this list are displayed

WoWiBackend::WoWiBackend::get_perm_solution sentList  ,
permtype  = 'all',
level  = 0
 

takes a sentNode and permutation contraints returns message dict with legal permutations

WoWiBackend::WoWiBackend::get_repl_solution constNode  ,
choices 
 

takes a const node and a list of choices returns a message dict with correct choice(s)

WoWiBackend::WoWiBackend::get_sentence permuted  = False,
structure  = 'words',
permtype  = 'all',
level  = 0
 

takes several configurations for the new exercise sentence: if 'permuted' is set to 'False' a sentence with 'normal' word order will be returned; if 'permuted' is set to 'True', any sentence with a permutatition licenced by 'level' will be returned returns a list of either TermNodes (Words) or movable ConstNodes, depending on the value of 'structure' throws BadRestrictionError if no appropriate sentence can be generated

WoWiBackend::WoWiBackend::get_sentence_with_marked_const permuted  = False,
structure  = 'words',
permtype  = 'all',
level  = 1,
choices  = []
 

returns tupel of a sentence list and index of a marked up constituent: (sentList, nr) (for word type exercise) the marked const is chosen according to the value of choices which is a list of possible values the constType may take (e.g. [n, fullverb, adj]) if after 5 tries, no sentence is found that contains an element that is member of choices, a BadRestrictionError is raised.

WoWiBackend::WoWiBackend::get_sentence_with_replacements permuted  = False,
structure  = 'consts',
permtype  = 'all',
level  = 1,
choices  = [],
wrong  = 1,
correct  = 1
 

returns a tupel containing:

  • a ConstNode list (representing the sentence)
  • an index number for the marked const
  • a shuffled list containing the specified number of wrong and correct replacements for the marked const


The documentation for this class was generated from the following file:
Generated on Tue Jul 19 23:31:01 2005 for WoWi by  doxygen 1.3.9.1