Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

HfstInputStream

eaxelson edited this pageFeb 8, 2018 ·12 revisions

class HfstInputStream

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, seehere.


__init__ (self, filename=None)

Create a stream for reading binary transducers.

Parameters:

  • filename The name of the transducer file. If not given, standard input is used.

Throws:

istr_to_stdin = hfst.HfstInputStream()istr_to_file = hfst.HfstInputStream(filename='transducer.hfst')

close (self)

Close the stream.

If the stream points to standard input, nothing is done.


is_eof (self)

Whether the stream is at end.


is_bad (self)

Whether badbit is set.


is_good (self)

Whether the state of the stream is good for input operations.


get_type (self)

The type of the first transducer in the stream.

By default, all transducers in a stream have the same type, elsea TransducerTypeMismatchException is thrown when reading the firsttransducer that has a different type than the previous ones.


read (self)

Return next transducer.

Throws:


read_all(self)

Return all transducers in stream.

Returns: A list of transducers.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp