Package gmisclib :: Module HTK_HMM_io :: Class tokstream
[frames] | no frames]

Class tokstream

source code


This breaks the HTK HMM file down into tokens.

Instance Methods
 
__init__(self, fdlist)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
str or None.
nextline(self)
Get the next line from the input files(s).
source code
 
__nonzero__(self)
Returns: True when there is more work to be done.
source code
(compiled regular expression, str)
get(self)
Get a token.
source code
 
get_name(self) source code
 
get_bracket(self) source code
 
get_int(self) source code
 
get_float(self) source code

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

Class Variables
  int = re.compile(r'([\+-]?\d+)')
  float = re.compile(r'([\+-]?[0-9]*\.[0-9]*[e0-9\+-]*)')
  bracket = re.compile(r'<\s*(\w+)\s*>')
  macro = re.compile(r'~([a-zA-Z])')
  name = re.compile(r'"([a-zA-Z_]\w*)"')
Properties

Inherited from object: __class__

Method Details

__init__(self, fdlist)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

nextline(self)

source code 

Get the next line from the input files(s). Sets self.line.

Returns: str or None.
the line.

__nonzero__(self)
(Boolean test operator)

source code 
Returns:
True when there is more work to be done.

get(self)

source code 

Get a token. This also sets self.fulltok with the full text of the token.

Returns: (compiled regular expression, str)
The regular expression that matches the next token, and the relevant text.
Raises:
  • BadFormatError - When the remainder of the line doesn't match any legal pattern.