-
Notifications
You must be signed in to change notification settings - Fork 1
HfstInputStream
eaxelson edited this page Feb 8, 2018
·
12 revisions
A stream for reading HFST binary transducers.
An example:
istr = hfst.HfstInputStream('testfile1.hfst')
transducers = []
while not (istr.is_eof()):
transducers.append(istr.read())
istr.close()
print("Read %i transducers in total." % len(transducers))
For documentation on the HFST binary transducer format, see here.
Create a stream for reading binary transducers.
Parameters:
-
filename
The name of the transducer file. If not given, standard input is used.
Throws:
- hfst.exceptions.StreamNotReadableException
- hfst.exceptions.NotTransducerStreamException
- hfst.exceptions.EndOfStreamException
- hfst.exceptions.TransducerHeaderException
istr_to_stdin = hfst.HfstInputStream()
istr_to_file = hfst.HfstInputStream(filename='transducer.hfst')
Close the stream.
If the stream points to standard input, nothing is done.
Whether the stream is at end.
Whether badbit is set.
Whether the state of the stream is good for input operations.
The type of the first transducer in the stream.
By default, all transducers in a stream have the same type, else a TransducerTypeMismatchException is thrown when reading the first transducer that has a different type than the previous ones.
Return next transducer.
Throws:
Return all transducers in stream.
Returns: A list of transducers.
Package hfst
- AttReader
- PrologReader
- HfstBasicTransducer
- HfstBasicTransition
- HfstTransducer
- HfstInputStream
- HfstOutputStream
- MultiCharSymbolTrie
- HfstTokenizer
- LexcCompiler
- XreCompiler
- PmatchContainer
- ImplementationType