Module text_data :: Class Ctext
[hide private]
[frames] | no frames]

Class Ctext

source code

This class encapsulates the text layer

Instance Methods [hide private]
 
__get_wf_nodes(self) source code
 
__init__(self, node=None, type='NAF')
Constructor of the object
source code
Cwf
__iter__(self)
Iterator that returns all the tokens
source code
 
add_wf(self, wf_obj)
Adds a token object to the text layer
source code
xml Element
get_node(self)
Returns the node of the element
source code
Cwf
get_wf(self, token_id)
Returns the token object for the given token identifier
source code
 
remove_tokens_of_sentence(self, sentence_id)
Removes the tokens of the given sentence
source code
 
to_kaf(self)
Converts the object to KAF (if it is NAF)
source code
 
to_naf(self)
Converts the object to NAF
source code
Method Details [hide private]

__init__(self, node=None, type='NAF')
(Constructor)

source code 

Constructor of the object

Parameters:
  • node (xml Element or None (to create and empty one)) - this is the node of the element. If it is None it will create a new object
  • type (string) - the type of the object (KAF or NAF)

__iter__(self)

source code 

Iterator that returns all the tokens

Returns: Cwf
single token objects

add_wf(self, wf_obj)

source code 

Adds a token object to the text layer

Parameters:
  • wf_obj (Cwf) - token object

get_node(self)

source code 

Returns the node of the element

Returns: xml Element
the node of the element

get_wf(self, token_id)

source code 

Returns the token object for the given token identifier

Parameters:
  • token_id (string) - the token identifier
Returns: Cwf
the token object

remove_tokens_of_sentence(self, sentence_id)

source code 

Removes the tokens of the given sentence

Parameters:
  • sentence_id (string) - the sentence identifier