Package nltk_lite :: Package contrib :: Package toolbox :: Module text :: Class Line
[hide private]
[frames] | no frames]

Class Line

source code

This class defines a line of interlinear glossing, such as:

   \ref 9
   \t Vigei    avapaviei                           atarisia.
   \m vigei    ava -pa       -vi        -ei        atari -sia
   \g 1.PL.INC go  -PROG     -1.PL.INCL -PRES      fish  -PURP
   \p PRO.PERS V.I -SUFF.V.3 -SUFF.VI.4 -SUFF.VI.5 V.I   -SUFF.V.4
   \fp Yumi bai go kisim pis.
   \fe We're going fishing.

The tiers of a line are saved as a sequential dictionary with all of its associated fields. Identified by the field marker \ref by default.

Instance Methods [hide private]
 
__init__(self, label=None)
Constructor that initializes Line object.
source code
 
add_field(self, field)
Add field to line.
source code
 
get_field_markers(self)
Obtain list of unique fields for the line.
source code
string
get_field_as_string(self, field_marker, join_string='')
This method returns a particular field given a field marker.
source code
 
get_field_values_by_field_marker(self, field_marker, sep=None)
Obtain all fields for a line, given a field marker.
source code
 
get_field_values(self)
Obtain list of field values for the line.
source code
 
get_label(self)
Obtain identifier for line.
source code
 
get_raw_text(self)
Obtain original line of text.
source code
 
set_label(self, label)
Set identifier for line.
source code
 
set_raw_text(self, rawtext)
Set original line of text.
source code
 
get_morphemes(self)
Obtain a list of morpheme objects for the line.
source code
 
get_words(self, flagParseMorphemes=True)
Obtain a list of word objects for the line.
source code
 
get_field_value_by_field_marker_and_column(self, field_marker, columnIndex)
Get values for line, given a field and column index.
source code
Method Details [hide private]

get_field_as_string(self, field_marker, join_string='')

source code 

This method returns a particular field given a field marker. Returns a blank string if field is not found.

Parameters:
  • field_marker (string) - marker of desired field
  • join_string (string) - string used to join field values (default to blank string)
Returns: string