Package nltk_lite :: Package corpora :: Module shoebox :: Class ShoeboxFile
[show private | hide private]
[frames | no frames]

Type ShoeboxFile

object --+
         |
        ShoeboxFile


Base class for Shoebox database and settings files.
Method Summary
  close(self)
Close a previously opened SFM file.
iterator over (marker, value) tuples fields(self, strip, unwrap, encoding, unicode_fields)
Return an iterator for the fields in the SFM file.
  open(self, sfm_file)
Open a standard format marker file for sequential reading.
  open_string(self, s)
Open a standard format marker file for sequential reading.
iterator over (marker, value) tuples raw_fields(self)
Return an iterator for the fields in the SFM file.
Inherited from object: __init__, __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Method Details

close(self)

Close a previously opened SFM file.

fields(self, strip=True, unwrap=True, encoding=None, unicode_fields=None)

Return an iterator for the fields in the SFM file.
Parameters:
strip - strip trailing whitespace from the last line of each field
           (type=boolean)
unwrap - Convert newlines in a field to spaces.
           (type=boolean)
encoding - Name of an encoding to use. If it is specified then fields method returns unicode strings rather than non unicode strings.
           (type=string or None)
unicode_fields - Set of marker names whose values are in unicode. Ignored if encoding is None.
           (type=set or dictionary (actually any sequence that supports the 'in' operator).)
Returns:
an iterator that returns the next field in a (marker, value) tuple. marker and value are unicode strings if an encoding was specified in the open method. Otherwise they are nonunicode strings.
           (type=iterator over (marker, value) tuples)

open(self, sfm_file)

Open a standard format marker file for sequential reading.
Parameters:
sfm_file - name of the standard format marker input file
           (type=string)

open_string(self, s)

Open a standard format marker file for sequential reading.
Parameters:
s - string to parse as a standard format marker input file
           (type=string)

raw_fields(self)

Return an iterator for the fields in the SFM file.
Returns:
an iterator that returns the next field in a (marker, value) tuple. Linebreaks and trailing white space are preserved except for the final newline in each field.
           (type=iterator over (marker, value) tuples)

Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 http://epydoc.sf.net