Created
December 9, 2014 23:11
-
-
Save stevenbedrick/3cd157b16536a544bb9b to your computer and use it in GitHub Desktop.
OpenFST: ASCII symbol table to binary symbol table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fst/fst.h> | |
#include <fst/symbol-table.h> | |
/* | |
Converts ASCII OpenFST symbol tables to binary symbol tables. To compile: | |
g++ -I/usr/local/lib/fst -L/usr/local/lib/fst -lfst -o convert_syms convert_syms.cc | |
Then, run: | |
./convert_syms ascii.syms.txt asci.syms.bin | |
No promises made vis-a-vis security, error handling, etc. etc. | |
Written by Steven Bedrick (bedricks@ohsu.edu) | |
*/ | |
using fst::SymbolTable; | |
int main (int argc, char const *argv[]) | |
{ | |
if (argc != 3) { | |
cout << "Usage: ./convert_syms $INFILE $OUTFILE" << endl; | |
exit(1); | |
} | |
SymbolTable *syms; | |
fst::SymbolTableTextOptions opts; | |
syms = SymbolTable::ReadText(argv[1], opts); | |
cout << "There are " << syms->NumSymbols() << " symbols in " << argv[1] << endl; | |
syms->Write(argv[2]); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment