|
|
|
@ -1,3 +1,17 @@
|
|
|
|
|
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
|
|
// bin/arpa2fst.cc
|
|
|
|
|
//
|
|
|
|
|
// Copyright 2009-2011 Gilles Boulianne.
|
|
|
|
@ -31,8 +45,10 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
"Usage: arpa2fst [opts] <input-arpa> <output-fst>\n"
|
|
|
|
|
" e.g.: arpa2fst --disambig-symbol=#0 --read-symbol-table="
|
|
|
|
|
"data/lang/words.txt lm/input.arpa G.fst\n\n"
|
|
|
|
|
"Note: When called without switches, the output G.fst will contain\n"
|
|
|
|
|
"an embedded symbol table. This is compatible with the way a previous\n"
|
|
|
|
|
"Note: When called without switches, the output G.fst will "
|
|
|
|
|
"contain\n"
|
|
|
|
|
"an embedded symbol table. This is compatible with the way a "
|
|
|
|
|
"previous\n"
|
|
|
|
|
"version of arpa2fst worked.\n";
|
|
|
|
|
|
|
|
|
|
ParseOptions po(usage);
|
|
|
|
@ -51,14 +67,20 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
|
|
|
|
|
po.Register("bos-symbol", &bos_symbol, "Beginning of sentence symbol");
|
|
|
|
|
po.Register("eos-symbol", &eos_symbol, "End of sentence symbol");
|
|
|
|
|
po.Register("disambig-symbol", &disambig_symbol,
|
|
|
|
|
po.Register(
|
|
|
|
|
"disambig-symbol",
|
|
|
|
|
&disambig_symbol,
|
|
|
|
|
"Disambiguator. If provided (e. g. #0), used on input side of "
|
|
|
|
|
"backoff links, and <s> and </s> are replaced with epsilons");
|
|
|
|
|
po.Register("read-symbol-table", &read_syms_filename,
|
|
|
|
|
po.Register("read-symbol-table",
|
|
|
|
|
&read_syms_filename,
|
|
|
|
|
"Use existing symbol table");
|
|
|
|
|
po.Register("write-symbol-table", &write_syms_filename,
|
|
|
|
|
po.Register("write-symbol-table",
|
|
|
|
|
&write_syms_filename,
|
|
|
|
|
"Write generated symbol table to a file");
|
|
|
|
|
po.Register("keep-symbols", &keep_symbols,
|
|
|
|
|
po.Register(
|
|
|
|
|
"keep-symbols",
|
|
|
|
|
&keep_symbols,
|
|
|
|
|
"Store symbol table with FST. Symbols always saved to FST if "
|
|
|
|
|
"symbol tables are neither read or written (otherwise symbols "
|
|
|
|
|
"would be lost entirely)");
|
|
|
|
|