Class Paradigm
source code
object --+
|
Paradigm
Paradigm visualisation class
*Usage*
Simple usage of the system would be:
>>> from paradigm import Paradigm
>>> p = Paradigm('german.xml')
>>> p.show('table(case, gender/number, content)')
Here, a table is generated in HTML format and sent to the file
``output.html``. The table can be viewed in a browser, and is updated for
every new query.
A more advanced usage of the system is show below. The user simply
creates a paradigm p, changes the output format and location, and calls a
dedicated prompt to enter the query:
>>> from paradigm import Paradigm
>>> p = Paradigm('german.xml')
>>> p.setFormat('html')
>>> p.setOutput('test.html')
>>> p.setCSS('simple.css')
>>> p.prompt()
> table(case, gender/number, content)
Please note, however, that plain text tables have not yet been
implemented.
|
__init__(self,
p_filename)
Load the given paradigm p_filename is a string representing the
filename of a paradigm xml file |
source code
|
|
|
prompt(self)
Changes to a dedicated prompt Type 'exit' or 'quit' to exit |
source code
|
|
|
show(self,
p_string)
Process and display the given query |
source code
|
|
|
setFormat(self,
p_string=None)
Set the output format: "html" or "text" |
source code
|
|
|
setCSS(self,
p_string=None)
Set the file location for a Cascading Stylesheet: None or filename
This allows for simple formatting |
source code
|
|
|
setOutput(self,
p_string=None)
Set the output location: "term" or filename |
source code
|
|
|
loadParadigm(self,
p_filename)
Load the given paradigm (XML file) Attributes are stored in
self.attributes Data are stored in self.data |
source code
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
Load the given paradigm p_filename is a string representing the
filename of a paradigm xml file
- Overrides:
object.__init__
|
Load the given paradigm (XML file) Attributes are stored in
self.attributes Data are stored in self.data
They can be accessed as follows: self.attributes['gender'] # list of
genders self.data[6]['gender'] # gender for the sixth data object
self.data[6]['content'] # content for the sixth data object
|