pyfst icon indicating copy to clipboard operation
pyfst copied to clipboard

read/write from a file *object*?

Open lebigot opened this issue 12 years ago • 2 comments

Would it be possible to have fst.read()/write() read/write from/to a file object? this would be more flexible than reading through a file name only. An example application is to store and possibly compress the binary representation of a transducer completely in memory (for storage in the field of a database, etc.). With the current approach, all of this has to be done through disk read/writes, and this is not optimal.

If I understand correctly, this functionality is provided in the C++ source (http://www.openfst.org/doxygen/fst/html/classfst_1_1_fst.html#ad2c233e6e5047677dca3458f1b36c4f6).

lebigot avatar Mar 24 '13 08:03 lebigot

Unfortunately, I don't know of any way to obtain a iostream for a Python file object...

vchahun avatar Apr 02 '13 02:04 vchahun

Thanks for considering this issue. :)

lebigot avatar Apr 02 '13 03:04 lebigot