Package nltk_lite :: Package contrib :: Module paradigmquery :: Class ParadigmQuery
[hide private]
[frames] | no frames]

Class ParadigmQuery

source code

object --+
         |
        ParadigmQuery

Class to read and parse a paradigm visualisation query

Instance Methods [hide private]
 
__init__(self, p_string=None)
Construct a query.
source code
 
parse(self, p_string)
Parses a string and stores the resulting hierarchy of "domains" "hierarchies" and "tables"
source code
 
getTree(self)
Returns the results from the CFG parsing
source code
 
getXML(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, p_string=None)
(Constructor)

source code 

Construct a query. Setup various attributes and parse given string

Overrides: object.__init__

parse(self, p_string)

source code 

Parses a string and stores the resulting hierarchy of "domains" "hierarchies" and "tables"

For the sake of NLP I've parsed the string using the nltk_lite context free grammar library.

A query is a "sentence" and can either be a domain, hierarchy or a table. A domain is simply a word. A hierarchy is expressed as "domain/domain" A table is exressed as "table(sentence, sentence, sentence)"

Internally the query is represented as a nltk_lite.parse.tree

Process:

  1. string is tokenized
  2. develop a context free grammar
  3. parse
  4. convert to a tree representation