Package nltk_lite :: Package contrib :: Package toolbox :: Module utilities :: Class Field
[hide private]
[frames] | no frames]

Class Field

source code

Class used to represent a standard fromat field. A field consists of a field marker and its value, stored as a tuple.

Instance Methods [hide private]
 
__init__(self, fieldMarker, fieldValue)
This method constructs a Field object as a tuple of a field marker and a field value.
source code
string
__str__(self)
This method returns the string representation of a Field object.
source code
string
get_marker(self)
This method returns the marker for a field.
source code
boolean
has_unique_value(self)
This method checks whether a field has a single value, in which case it returns true, or multiple values, in which case it returns false.
source code
boolean
has_value(self)
This method checks whether a field has a value or not.
source code
a list of values or a string of these values joined by sep
get_values(self, sep=None)
This method returns the values for a field, either as a raw list of values or, if a separator string is provided, as a formatted string.
source code
Method Details [hide private]

__init__(self, fieldMarker, fieldValue)
(Constructor)

source code 

This method constructs a Field object as a tuple of a field marker and a field value.

Parameters:
  • fieldMarker (string) - a field's marker
  • fieldValue (string) - a field's value (the actual data)

__str__(self)
(Informal representation operator)

source code 

This method returns the string representation of a Field object.

Returns: string
a Field object formatted as a string

get_marker(self)

source code 

This method returns the marker for a field.

Returns: string
a field's marker

has_unique_value(self)

source code 

This method checks whether a field has a single value, in which case it returns true, or multiple values, in which case it returns false.

Returns: boolean
whether the value for a given field is unique

has_value(self)

source code 

This method checks whether a field has a value or not.

Returns: boolean
whether a given field has a value

get_values(self, sep=None)

source code 

This method returns the values for a field, either as a raw list of values or, if a separator string is provided, as a formatted string.

Returns: a list of values or a string of these values joined by sep
the values for a field; if sep provided, formatted as string