pyfst
pyfst copied to clipboard
read/write from a file *object*?
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).
Unfortunately, I don't know of any way to obtain a iostream for a Python file object...
Thanks for considering this issue. :)