Initial commit: FunASR Speech Recognition Toolkit
Update API Documentation / build-api-docs (push) Has been cancelled

Add complete FunASR codebase including models, runtime, and documentation.
This commit is contained in:
freedakgmail
2026-07-09 22:38:58 +08:00
commit 6116b1f3c6
3683 changed files with 990984 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
; EditorConfig to support per-solution formatting.
; Use the EditorConfig VS add-in to make this work before VS 2017
; This is the default for the codeline.
root = true
[*]
charset = utf-8 ; Remove the pesky BOM from files.
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@@ -0,0 +1,31 @@
# Ignore extensionless files
*
!*.*
!*/
# Other patterns
/config.h
/config.log
/config.status
.deps/
.libs/
.dirstamp
*.la
*.lo
*.o
# Windows-specific files
.vs/
*.VC.db
Win32/
x64/
Debug/
Release/
obj/
/bin/
*.binlog
*proj.user
/cmake
/cmake64
/CMakeSettings.json
/*.zip
+931
View File
@@ -0,0 +1,931 @@
# Copyright 2015-2019 Google LLC. 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.
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
exports_files(["COPYING"])
prefix_dir = "src/"
static_binary = 1
# Core library (lib/)
cc_library(
name = "fst-decl",
hdrs = [prefix_dir + "include/fst/fst-decl.h"],
includes = [prefix_dir + "include"],
deps = [":base"],
)
PUBLIC_HEADERS = [
# One-stop header file which includes the remaining headers below:
prefix_dir + "include/fst/fstlib.h",
# Fine-grained headers:
prefix_dir + "include/fst/accumulator.h",
prefix_dir + "include/fst/add-on.h",
prefix_dir + "include/fst/arc-arena.h",
prefix_dir + "include/fst/arc-map.h",
prefix_dir + "include/fst/arc.h",
prefix_dir + "include/fst/arcfilter.h",
prefix_dir + "include/fst/arcsort.h",
prefix_dir + "include/fst/bi-table.h",
prefix_dir + "include/fst/cache.h",
prefix_dir + "include/fst/closure.h",
prefix_dir + "include/fst/compact-fst.h",
prefix_dir + "include/fst/complement.h",
prefix_dir + "include/fst/compose-filter.h",
prefix_dir + "include/fst/compose.h",
prefix_dir + "include/fst/concat.h",
prefix_dir + "include/fst/connect.h",
prefix_dir + "include/fst/const-fst.h",
prefix_dir + "include/fst/determinize.h",
prefix_dir + "include/fst/dfs-visit.h",
prefix_dir + "include/fst/difference.h",
prefix_dir + "include/fst/disambiguate.h",
prefix_dir + "include/fst/edit-fst.h",
prefix_dir + "include/fst/encode.h",
prefix_dir + "include/fst/epsnormalize.h",
prefix_dir + "include/fst/equal.h",
prefix_dir + "include/fst/equivalent.h",
prefix_dir + "include/fst/expanded-fst.h",
prefix_dir + "include/fst/factor-weight.h",
prefix_dir + "include/fst/filter-state.h",
prefix_dir + "include/fst/fst.h",
prefix_dir + "include/fst/heap.h",
prefix_dir + "include/fst/intersect.h",
prefix_dir + "include/fst/invert.h",
prefix_dir + "include/fst/isomorphic.h",
prefix_dir + "include/fst/label-reachable.h",
prefix_dir + "include/fst/lookahead-filter.h",
prefix_dir + "include/fst/lookahead-matcher.h",
prefix_dir + "include/fst/map.h",
prefix_dir + "include/fst/matcher-fst.h",
prefix_dir + "include/fst/matcher.h",
prefix_dir + "include/fst/memory.h",
prefix_dir + "include/fst/minimize.h",
prefix_dir + "include/fst/mutable-fst.h",
prefix_dir + "include/fst/partition.h",
prefix_dir + "include/fst/project.h",
prefix_dir + "include/fst/properties.h",
prefix_dir + "include/fst/prune.h",
prefix_dir + "include/fst/push.h",
prefix_dir + "include/fst/queue.h",
prefix_dir + "include/fst/randequivalent.h",
prefix_dir + "include/fst/randgen.h",
prefix_dir + "include/fst/rational.h",
prefix_dir + "include/fst/relabel.h",
prefix_dir + "include/fst/replace-util.h",
prefix_dir + "include/fst/replace.h",
prefix_dir + "include/fst/reverse.h",
prefix_dir + "include/fst/reweight.h",
prefix_dir + "include/fst/rmepsilon.h",
prefix_dir + "include/fst/rmfinalepsilon.h",
prefix_dir + "include/fst/shortest-distance.h",
prefix_dir + "include/fst/shortest-path.h",
prefix_dir + "include/fst/state-map.h",
prefix_dir + "include/fst/state-reachable.h",
prefix_dir + "include/fst/state-table.h",
prefix_dir + "include/fst/statesort.h",
prefix_dir + "include/fst/string.h",
prefix_dir + "include/fst/symbol-table-ops.h",
prefix_dir + "include/fst/synchronize.h",
prefix_dir + "include/fst/test-properties.h",
prefix_dir + "include/fst/topsort.h",
prefix_dir + "include/fst/union.h",
prefix_dir + "include/fst/vector-fst.h",
prefix_dir + "include/fst/verify.h",
prefix_dir + "include/fst/visit.h",
]
# This version does not have the export-dynamic flag set and should not be
# used to load dynamic-shared object FST extensions. Please see the
# "lib_export_dynamic" target below for binaries that need DSO loading.
cc_library(
name = "lib_lite",
srcs = [
prefix_dir + "lib/fst.cc",
prefix_dir + "lib/properties.cc",
prefix_dir + "lib/symbol-table-ops.cc",
],
hdrs = PUBLIC_HEADERS,
copts = ["-Wno-sign-compare"],
includes = [prefix_dir + "include"],
linkopts = ["-lm"],
deps = [
":base",
":fst-decl",
":icu",
":interval-set",
":register",
":symbol-table",
":union-find",
":util",
":weight",
],
)
cc_library(
name = "fst",
hdrs = PUBLIC_HEADERS,
includes = [prefix_dir + "include"],
deps = [
":fst-types",
":lib_lite",
],
)
cc_library(
name = "lib_export_dynamic",
linkopts = ["-Wl,--export-dynamic"],
deps = [":fst"],
)
cc_library(
name = "fst-types",
srcs = [prefix_dir + "lib/fst-types.cc"],
deps = [":lib_lite"],
alwayslink = 1, # because of registration
)
cc_library(
name = "symbol-table",
srcs = [prefix_dir + "lib/symbol-table.cc"],
hdrs = [prefix_dir + "include/fst/symbol-table.h"],
copts = ["-Wno-sign-compare"],
includes = [prefix_dir + "include"],
deps = [
":base",
":util",
],
)
cc_library(
name = "weight",
srcs = [prefix_dir + "lib/weight.cc"],
hdrs = [
prefix_dir + "include/fst/expectation-weight.h",
prefix_dir + "include/fst/float-weight.h",
prefix_dir + "include/fst/lexicographic-weight.h",
prefix_dir + "include/fst/pair-weight.h",
prefix_dir + "include/fst/power-weight.h",
prefix_dir + "include/fst/product-weight.h",
prefix_dir + "include/fst/set-weight.h",
prefix_dir + "include/fst/signed-log-weight.h",
prefix_dir + "include/fst/sparse-power-weight.h",
prefix_dir + "include/fst/sparse-tuple-weight.h",
prefix_dir + "include/fst/string-weight.h",
prefix_dir + "include/fst/tuple-weight.h",
prefix_dir + "include/fst/union-weight.h",
prefix_dir + "include/fst/weight.h",
],
includes = [prefix_dir + "include"],
linkopts = ["-lm"],
deps = [
":base",
":util",
],
)
cc_library(
name = "interval-set",
hdrs = [prefix_dir + "include/fst/interval-set.h"],
includes = [prefix_dir + "include"],
deps = [
":base",
":util",
],
)
cc_library(
name = "register",
hdrs = [
prefix_dir + "include/fst/generic-register.h",
prefix_dir + "include/fst/register.h",
],
includes = [prefix_dir + "include"],
linkopts = ["-ldl"],
deps = [
":base",
":util",
],
)
cc_library(
name = "icu",
hdrs = [
prefix_dir + "include/fst/icu.h",
],
)
cc_library(
name = "union-find",
hdrs = [prefix_dir + "include/fst/union-find.h"],
includes = [prefix_dir + "include"],
deps = [":base"],
)
cc_library(
name = "util",
srcs = [
prefix_dir + "lib/mapped-file.cc",
prefix_dir + "lib/util.cc",
],
hdrs = [
prefix_dir + "include/fst/mapped-file.h",
prefix_dir + "include/fst/util.h",
],
includes = [prefix_dir + "include"],
deps = [":base"],
)
cc_library(
name = "base",
srcs = [
prefix_dir + "lib/compat.cc",
prefix_dir + "lib/flags.cc",
],
hdrs = [
prefix_dir + "include/fst/compat.h",
prefix_dir + "include/fst/config.h",
prefix_dir + "include/fst/flags.h",
prefix_dir + "include/fst/icu.h",
prefix_dir + "include/fst/lock.h",
prefix_dir + "include/fst/log.h",
prefix_dir + "include/fst/types.h",
],
includes = [prefix_dir + "include"],
)
# Core library tests (test/)
cc_test(
name = "fst_test",
timeout = "short",
srcs = [
prefix_dir + "test/fst_test.cc",
prefix_dir + "include/fst/test/fst_test.h",
],
deps = [":fst"],
)
cc_library(
name = "weight-tester",
testonly = 1,
hdrs = [prefix_dir + "include/fst/test/weight-tester.h"],
includes = [prefix_dir],
deps = [":weight"],
)
cc_test(
name = "weight_test",
timeout = "short",
srcs = [prefix_dir + "test/weight_test.cc"],
copts = ["-Wno-unused-local-typedefs"],
deps = [
":fst",
":weight-tester",
],
)
[
cc_test(
name = "algo_test_%s" % weight,
srcs = [
prefix_dir + "test/algo_test.cc",
prefix_dir + "include/fst/test/algo_test.h",
prefix_dir + "include/fst/test/rand-fst.h",
],
defines = ["TEST_%s" % weight.upper()],
deps = [":fst"],
)
for weight in [
"tropical",
"log",
"minmax",
"lexicographic",
"power",
]
]
# Non-template scripting-language integration (script/)
cc_library(
name = "fstscript_base",
srcs = [
prefix_dir + "script/arciterator-class.cc",
prefix_dir + "script/encodemapper-class.cc",
prefix_dir + "script/fst-class.cc",
prefix_dir + "script/getters.cc",
prefix_dir + "script/stateiterator-class.cc",
prefix_dir + "script/text-io.cc",
prefix_dir + "script/weight-class.cc",
],
hdrs = [
prefix_dir + "include/fst/script/arc-class.h",
prefix_dir + "include/fst/script/arciterator-class.h",
prefix_dir + "include/fst/script/arg-packs.h",
prefix_dir + "include/fst/script/encodemapper-class.h",
prefix_dir + "include/fst/script/fst-class.h",
prefix_dir + "include/fst/script/fstscript-decl.h",
prefix_dir + "include/fst/script/fstscript.h",
prefix_dir + "include/fst/script/getters.h",
prefix_dir + "include/fst/script/register.h",
prefix_dir + "include/fst/script/script-impl.h",
prefix_dir + "include/fst/script/stateiterator-class.h",
prefix_dir + "include/fst/script/text-io.h",
prefix_dir + "include/fst/script/weight-class.h",
#
prefix_dir + "include/fst/script/arcsort.h",
prefix_dir + "include/fst/script/closure.h",
prefix_dir + "include/fst/script/compile.h",
prefix_dir + "include/fst/script/compile-impl.h",
prefix_dir + "include/fst/script/compose.h",
prefix_dir + "include/fst/script/concat.h",
prefix_dir + "include/fst/script/connect.h",
prefix_dir + "include/fst/script/convert.h",
prefix_dir + "include/fst/script/decode.h",
prefix_dir + "include/fst/script/determinize.h",
prefix_dir + "include/fst/script/difference.h",
prefix_dir + "include/fst/script/disambiguate.h",
prefix_dir + "include/fst/script/draw.h",
prefix_dir + "include/fst/script/draw-impl.h",
prefix_dir + "include/fst/script/encode.h",
prefix_dir + "include/fst/script/epsnormalize.h",
prefix_dir + "include/fst/script/equal.h",
prefix_dir + "include/fst/script/equivalent.h",
prefix_dir + "include/fst/script/info.h",
prefix_dir + "include/fst/script/info-impl.h",
prefix_dir + "include/fst/script/intersect.h",
prefix_dir + "include/fst/script/invert.h",
prefix_dir + "include/fst/script/isomorphic.h",
prefix_dir + "include/fst/script/map.h",
prefix_dir + "include/fst/script/minimize.h",
prefix_dir + "include/fst/script/print.h",
prefix_dir + "include/fst/script/print-impl.h",
prefix_dir + "include/fst/script/project.h",
prefix_dir + "include/fst/script/prune.h",
prefix_dir + "include/fst/script/push.h",
prefix_dir + "include/fst/script/randequivalent.h",
prefix_dir + "include/fst/script/randgen.h",
prefix_dir + "include/fst/script/relabel.h",
prefix_dir + "include/fst/script/replace.h",
prefix_dir + "include/fst/script/reverse.h",
prefix_dir + "include/fst/script/reweight.h",
prefix_dir + "include/fst/script/rmepsilon.h",
prefix_dir + "include/fst/script/shortest-distance.h",
prefix_dir + "include/fst/script/shortest-path.h",
prefix_dir + "include/fst/script/synchronize.h",
prefix_dir + "include/fst/script/topsort.h",
prefix_dir + "include/fst/script/union.h",
prefix_dir + "include/fst/script/verify.h",
],
copts = ["-Wno-sign-compare"],
includes = [prefix_dir + "include"],
deps = [":fst"],
)
[
cc_library(
name = "fstscript_%s" % operation,
srcs = [prefix_dir + "script/%s.cc" % operation],
hdrs = [prefix_dir + "include/fst/script/%s.h" % operation],
includes = [prefix_dir + "include"],
deps = [":fstscript_base"],
)
for operation in [
"arcsort",
"closure",
"concat",
"connect",
"convert",
"decode",
"determinize",
"disambiguate",
"encode",
"epsnormalize",
"equal",
"equivalent",
"invert",
"isomorphic",
"map",
"minimize",
"project",
"prune",
"push",
"randgen",
"relabel",
"replace",
"reverse",
"reweight",
"synchronize",
"topsort",
"union",
"verify",
]
]
cc_library(
name = "fstscript_compile",
srcs = [prefix_dir + "script/compile.cc"],
hdrs = [
prefix_dir + "include/fst/script/compile.h",
prefix_dir + "include/fst/script/compile-impl.h",
],
includes = [prefix_dir + "include"],
deps = [":fstscript_base"],
)
cc_library(
name = "fstscript_compose",
srcs = [prefix_dir + "script/compose.cc"],
hdrs = [prefix_dir + "include/fst/script/compose.h"],
includes = [prefix_dir + "include"],
deps = [
":fstscript_base",
":fstscript_connect",
],
)
cc_library(
name = "fstscript_difference",
srcs = [prefix_dir + "script/difference.cc"],
hdrs = [prefix_dir + "include/fst/script/difference.h"],
includes = [prefix_dir + "include"],
deps = [
":fstscript_base",
":fstscript_compose",
],
)
cc_library(
name = "fstscript_draw",
srcs = [prefix_dir + "script/draw.cc"],
hdrs = [
prefix_dir + "include/fst/script/draw.h",
prefix_dir + "include/fst/script/draw-impl.h",
],
includes = [prefix_dir + "include"],
deps = [":fstscript_base"],
)
cc_library(
name = "fstscript_info",
srcs = [
prefix_dir + "script/info.cc",
prefix_dir + "script/info-impl.cc",
],
hdrs = [
prefix_dir + "include/fst/script/info.h",
prefix_dir + "include/fst/script/info-impl.h",
],
includes = [prefix_dir + "include"],
deps = [":fstscript_base"],
)
cc_library(
name = "fstscript_intersect",
srcs = [prefix_dir + "script/intersect.cc"],
hdrs = [prefix_dir + "include/fst/script/intersect.h"],
includes = [prefix_dir + "include"],
deps = [
":fstscript_base",
":fstscript_compose",
],
)
cc_library(
name = "fstscript_print",
srcs = [prefix_dir + "script/print.cc"],
hdrs = [
prefix_dir + "include/fst/script/print.h",
prefix_dir + "include/fst/script/print-impl.h",
],
includes = [prefix_dir + "include"],
deps = [":fstscript_base"],
)
cc_library(
name = "fstscript_randequivalent",
srcs = [prefix_dir + "script/randequivalent.cc"],
hdrs = [prefix_dir + "include/fst/script/randequivalent.h"],
includes = [prefix_dir + "include"],
deps = [
":fstscript_base",
":fstscript_randgen",
],
)
cc_library(
name = "fstscript_rmepsilon",
srcs = [prefix_dir + "script/rmepsilon.cc"],
hdrs = [prefix_dir + "include/fst/script/rmepsilon.h"],
includes = [prefix_dir + "include"],
deps = [
":fstscript_base",
":fstscript_shortest_distance",
],
)
cc_library(
name = "fstscript_shortest_distance",
srcs = [prefix_dir + "script/shortest-distance.cc"],
hdrs = [prefix_dir + "include/fst/script/shortest-distance.h"],
includes = [prefix_dir + "include"],
deps = [
":fstscript_base",
":fstscript_prune",
],
)
cc_library(
name = "fstscript_shortest_path",
srcs = [prefix_dir + "script/shortest-path.cc"],
hdrs = [prefix_dir + "include/fst/script/shortest-path.h"],
includes = [prefix_dir + "include"],
deps = [
":fstscript_base",
":fstscript_shortest_distance",
],
)
cc_library(
name = "fstscript",
deps = [
":fstscript_arcsort",
":fstscript_closure",
":fstscript_compile",
":fstscript_compose",
":fstscript_concat",
":fstscript_connect",
":fstscript_convert",
":fstscript_decode",
":fstscript_determinize",
":fstscript_difference",
":fstscript_disambiguate",
":fstscript_draw",
":fstscript_encode",
":fstscript_epsnormalize",
":fstscript_equal",
":fstscript_equivalent",
":fstscript_info",
":fstscript_intersect",
":fstscript_invert",
":fstscript_isomorphic",
":fstscript_map",
":fstscript_minimize",
":fstscript_print",
":fstscript_project",
":fstscript_prune",
":fstscript_push",
":fstscript_randequivalent",
":fstscript_randgen",
":fstscript_relabel",
":fstscript_replace",
":fstscript_reverse",
":fstscript_reweight",
":fstscript_rmepsilon",
":fstscript_shortest_distance",
":fstscript_shortest_path",
":fstscript_synchronize",
":fstscript_topsort",
":fstscript_union",
":fstscript_verify",
],
)
# Command-line binaries (bin/)
[
cc_binary(
name = "fst%s" % operation.replace("_", ""),
srcs = [
prefix_dir + "bin/fst%s.cc" % operation.replace("_", ""),
prefix_dir + "bin/fst%s-main.cc" % operation.replace("_", ""),
],
linkstatic = static_binary,
deps = [":fstscript_%s" % operation],
)
for operation in [
"arcsort",
"closure",
"compile",
"compose",
"concat",
"connect",
"convert",
"determinize",
"difference",
"disambiguate",
"draw",
"epsnormalize",
"equal",
"info",
"intersect",
"invert",
"isomorphic",
"map",
"minimize",
"print",
"project",
"prune",
"push",
"randgen",
"relabel",
"replace",
"reverse",
"reweight",
"rmepsilon",
"shortest_distance",
"shortest_path",
"synchronize",
"topsort",
"union",
]
]
cc_binary(
name = "fstencode",
srcs = [
prefix_dir + "bin/fstencode.cc",
prefix_dir + "bin/fstencode-main.cc",
],
linkstatic = static_binary,
deps = [
":fstscript_decode",
":fstscript_encode",
],
)
cc_binary(
name = "fstequivalent",
srcs = [
prefix_dir + "bin/fstequivalent.cc",
prefix_dir + "bin/fstequivalent-main.cc",
],
linkstatic = static_binary,
deps = [
":fstscript_equivalent",
":fstscript_randequivalent",
],
)
cc_binary(
name = "fstsymbols",
srcs = [
prefix_dir + "bin/fstsymbols.cc",
prefix_dir + "bin/fstsymbols-main.cc",
],
linkstatic = static_binary,
deps = [":fstscript_verify"],
)
# Extension: Fst ARchive a/k/a FAR (extensions/far/)
cc_library(
name = "sttable",
srcs = [
prefix_dir + "extensions/far/stlist.cc",
prefix_dir + "extensions/far/sttable.cc",
],
hdrs = [
prefix_dir + "include/fst/extensions/far/stlist.h",
prefix_dir + "include/fst/extensions/far/sttable.h",
],
includes = [prefix_dir + "include"],
deps = [":util"],
)
cc_library(
name = "far_base",
hdrs = [
prefix_dir + "include/fst/extensions/far/far.h",
],
includes = [prefix_dir + "include"],
deps = [
":fst",
":sttable",
],
)
cc_library(
name = "far",
srcs = [prefix_dir + "extensions/far/strings.cc"],
hdrs = [
prefix_dir + "include/fst/extensions/far/compile-strings.h",
prefix_dir + "include/fst/extensions/far/create.h",
prefix_dir + "include/fst/extensions/far/equal.h",
prefix_dir + "include/fst/extensions/far/extract.h",
prefix_dir + "include/fst/extensions/far/farlib.h",
prefix_dir + "include/fst/extensions/far/info.h",
prefix_dir + "include/fst/extensions/far/isomorphic.h",
prefix_dir + "include/fst/extensions/far/print-strings.h",
],
includes = [prefix_dir + "include"],
deps = [
":far_base",
":fst",
],
)
cc_library(
name = "farscript",
srcs = [
prefix_dir + "extensions/far/far-class.cc",
prefix_dir + "extensions/far/farscript.cc",
prefix_dir + "extensions/far/getters.cc",
prefix_dir + "extensions/far/script-impl.cc",
prefix_dir + "extensions/far/strings.cc",
],
hdrs = [
prefix_dir + "include/fst/extensions/far/compile-strings.h",
prefix_dir + "include/fst/extensions/far/far-class.h",
prefix_dir + "include/fst/extensions/far/farscript.h",
prefix_dir + "include/fst/extensions/far/getters.h",
prefix_dir + "include/fst/extensions/far/script-impl.h",
],
includes = [prefix_dir + "include"],
deps = [
":base",
":far",
":fstscript_base",
],
)
[
cc_binary(
name = "far%s" % operation,
srcs = [prefix_dir + "extensions/far/far%s.cc" % operation],
linkstatic = static_binary,
deps = [":farscript"],
)
for operation in [
"compilestrings",
"create",
"equal",
"extract",
"info",
"isomorphic",
"printstrings",
]
]
# Extension: PushDown Transducers a/k/a PDT (extensions/pdt/)
cc_library(
name = "pdt",
hdrs = [
prefix_dir + "include/fst/extensions/pdt/collection.h",
prefix_dir + "include/fst/extensions/pdt/compose.h",
prefix_dir + "include/fst/extensions/pdt/expand.h",
prefix_dir + "include/fst/extensions/pdt/getters.h",
prefix_dir + "include/fst/extensions/pdt/info.h",
prefix_dir + "include/fst/extensions/pdt/paren.h",
prefix_dir + "include/fst/extensions/pdt/pdt.h",
prefix_dir + "include/fst/extensions/pdt/pdtlib.h",
prefix_dir + "include/fst/extensions/pdt/replace.h",
prefix_dir + "include/fst/extensions/pdt/reverse.h",
prefix_dir + "include/fst/extensions/pdt/shortest-path.h",
],
includes = [prefix_dir + "include"],
deps = [
":fst",
],
)
cc_library(
name = "pdtscript",
srcs = [
prefix_dir + "extensions/pdt/getters.cc",
prefix_dir + "extensions/pdt/pdtscript.cc",
],
hdrs = [
prefix_dir + "include/fst/extensions/pdt/getters.h",
prefix_dir + "include/fst/extensions/pdt/pdtscript.h",
],
includes = [prefix_dir + "include"],
deps = [
":fst",
":fstscript_base",
":pdt",
],
)
cc_binary(
name = "pdtcompose",
srcs = [prefix_dir + "extensions/pdt/pdtcompose.cc"],
linkstatic = static_binary,
deps = [
":fstscript_connect",
":pdtscript",
],
)
[
cc_binary(
name = "pdt%s" % operation,
srcs = [prefix_dir + "extensions/pdt/pdt%s.cc" % operation],
linkstatic = static_binary,
deps = [":pdtscript"],
)
for operation in [
"expand",
"info",
"replace",
"reverse",
"shortestpath",
]
]
# Extension: Multi PushDown Transducers a/k/a MPDT (extensions/mpdt/)
cc_library(
name = "mpdt",
hdrs = [
prefix_dir + "include/fst/extensions/mpdt/compose.h",
prefix_dir + "include/fst/extensions/mpdt/expand.h",
prefix_dir + "include/fst/extensions/mpdt/info.h",
prefix_dir + "include/fst/extensions/mpdt/mpdt.h",
prefix_dir + "include/fst/extensions/mpdt/mpdtlib.h",
prefix_dir + "include/fst/extensions/mpdt/read_write_utils.h",
prefix_dir + "include/fst/extensions/mpdt/reverse.h",
],
includes = [prefix_dir + "include"],
deps = [
":fst",
":pdt",
],
)
cc_library(
name = "mpdtscript",
srcs = [prefix_dir + "extensions/mpdt/mpdtscript.cc"],
hdrs = [prefix_dir + "include/fst/extensions/mpdt/mpdtscript.h"],
includes = [prefix_dir + "include"],
deps = [
":fst",
":fstscript_base",
":mpdt",
":pdtscript",
],
)
cc_binary(
name = "mpdtcompose",
srcs = [prefix_dir + "extensions/mpdt/mpdtcompose.cc"],
linkstatic = static_binary,
deps = [
":fstscript_connect",
":mpdtscript",
],
)
[
cc_binary(
name = "mpdt%s" % operation,
srcs = [prefix_dir + "extensions/mpdt/mpdt%s.cc" % operation],
linkstatic = static_binary,
deps = [":mpdtscript"],
)
for operation in [
"expand",
"info",
"reverse",
]
]
# Extension: LOUDS compressed n-gram language models (extensions/ngram/)
cc_library(
name = "ngram",
srcs = [
prefix_dir + "extensions/ngram/bitmap-index.cc",
prefix_dir + "extensions/ngram/ngram-fst.cc",
prefix_dir + "extensions/ngram/nthbit.cc",
],
hdrs = [
prefix_dir + "include/fst/extensions/ngram/bitmap-index.h",
prefix_dir + "include/fst/extensions/ngram/ngram-fst.h",
prefix_dir + "include/fst/extensions/ngram/nthbit.h",
],
includes = [prefix_dir + "include"],
deps = [
":fst",
],
)
# TODO: Extensions compact, compress, const, linear, lookahead, python, special
+71
View File
@@ -0,0 +1,71 @@
project(openfst)
include(CTest)
find_package(ICU COMPONENTS data i18n io test tu uc)
if (ICU_FOUND)
include_directories(${ICU_INCLUDE_DIRS})
set(LIBS ${LIBS} ${ICU_LIBRARIES})
endif (ICU_FOUND)
find_package(ZLIB)
if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRECTORIES})
set(ZLIBS ${ZLIB_LIBRARIES})
endif (ZLIB_FOUND)
cmake_minimum_required(VERSION 3.1)
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_CXX_STANDARD 11)
if (WIN32)
add_definitions(/bigobj)
set(WHOLEFST "/WHOLEARCHIVE:fst")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WHOLEFST}")
#set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)
#this must be disabled unless the previous option (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS) is enabled
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
else()
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif (WIN32)
set(SOVERSION "16")
OPTION(BUILD_USE_SOLUTION_FOLDERS "Enable grouping of projects in VS" ON)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ${BUILD_USE_SOLUTION_FOLDERS})
option(HAVE_BIN "Build the fst binaries" ON)
option(HAVE_SCRIPT "Build the fstscript" ON)
option(HAVE_COMPACT "Build compact" ON)
option(HAVE_COMPRESS "Build compress" OFF)
option(HAVE_CONST "Build const" ON)
option(HAVE_FAR "Build far" ON)
option(HAVE_GRM "Build grm" ON)
option(HAVE_PDT "Build pdt" ON)
option(HAVE_MPDT "Build mpdt" ON)
option(HAVE_LINEAR "Build linear" ON)
option(HAVE_LOOKAHEAD "Build lookahead" ON)
option(HAVE_NGRAM "Build ngram" ON)
option(HAVE_PYTHON "Build python" OFF)
option(HAVE_SPECIAL "Build special" ON)
set(WITH_GFLAGS OFF CACHE BOOL "whether build glog with gflags" FORCE)
if (WIN32)
set(HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE)
set(HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE)
else()
set(HAVE_BIN ON CACHE BOOL "Build the fst binaries" FORCE)
set(HAVE_SCRIPT ON CACHE BOOL "Build the fstscript" FORCE)
endif (WIN32)
set(HAVE_COMPACT OFF CACHE BOOL "Build compact" FORCE)
set(HAVE_CONST OFF CACHE BOOL "Build const" FORCE)
set(HAVE_GRM OFF CACHE BOOL "Build grm" FORCE)
set(HAVE_FAR OFF CACHE BOOL "Build far" FORCE)
set(HAVE_PDT OFF CACHE BOOL "Build pdt" FORCE)
set(HAVE_MPDT OFF CACHE BOOL "Build mpdt" FORCE)
set(HAVE_LINEAR OFF CACHE BOOL "Build linear" FORCE)
set(HAVE_LOOKAHEAD OFF CACHE BOOL "Build lookahead" FORCE)
set(HAVE_NGRAM OFF CACHE BOOL "Build ngram" FORCE)
set(HAVE_SPECIAL OFF CACHE BOOL "Build special" FORCE)
add_subdirectory(src)
+4
View File
@@ -0,0 +1,4 @@
SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = BUILD.bazel
+842
View File
@@ -0,0 +1,842 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h $(top_builddir)/src/include/fst/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/src/include/fst/config.h.in AUTHORS COPYING \
INSTALL NEWS README ar-lib compile config.guess config.sub \
install-sh ltmain.sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PYTHON = @PYTHON@
PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
libfstdir = @libfstdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = BUILD.bazel
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
src/include/fst/config.h: src/include/fst/stamp-h2
@test -f $@ || rm -f src/include/fst/stamp-h2
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) src/include/fst/stamp-h2
src/include/fst/stamp-h2: $(top_srcdir)/src/include/fst/config.h.in $(top_builddir)/config.status
@rm -f src/include/fst/stamp-h2
cd $(top_builddir) && $(SHELL) ./config.status src/include/fst/config.h
distclean-hdr:
-rm -f config.h stamp-h1 src/include/fst/config.h src/include/fst/stamp-h2
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(am__recursive_targets) all install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool cscope cscopelist-am ctags ctags-am dist \
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-generic \
distclean-hdr distclean-libtool distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+113
View File
@@ -0,0 +1,113 @@
# OpenFST port for Windows
OpenFst is a library for constructing, combining, optimizing, and searching
weighted finite-state transducers (FSTs), maintained by Google and released
under the [Apache 2.0 license](./COPYING). The home page for the library is
located at http://openfst.org/. Check the [original README file](./README)
for the current version, as we are not updating this file with the current
release version. Make sure also to check the [NEWS](./NEWS) file for the
latest changes.
## Releases
We track [original releases](http://www.openfst.org/twiki/bin/view/FST/FstDownload)
of the library, and try to keep [ours](https://github.com/kkm000/openfst/releases)
in step. Sometimes we may skip a release, but we strive for that to be rather an
exception. With each release, we drop a set of pre-built .exe files compiled for
the x64 architecture and optimized for execution speed. We use the latest
Microsoft compilers for it, so you may find you need to download and install the
latest Microsoft C runtime. See [Microsoft KB2977003](https://support.microsoft.com/help/2977003/)
for instructions.
We do not release pre-built libraries, however, because Microsoft compiler ABI
changes between versions, and is different for Debug and Release builds. You
must build a library matching your toolset on your own.
## Build
There are two build options: Visual Studio and CMake. We maintain a set of
build scripts for both. You will need a recent enough Visual Studio for either
build flavor. Microsoft provides an option to download the free Visual Studio
[Community Edition](https://visualstudio.microsoft.com/downloads/), which is
adequate.
### Visual Studio
Open `openfst.sln`, then read the comments in files under the "READ ME BEFORE
BUILD" solution folder. Generally, you may just hit Build and get the
libraries, unless you need fine-tuning, such as selecting a different toolset,
or want to build with MSBuild from command line. The solutions builds only
static libraries, with debug information embedded in C7 format for the
simplicity of use. Set the platform to `x86` or `x64` to build a respective
32- or 64-bit version of the library and tools.
The `bin` project builds multiple executable files by invoking itself
recursively once for each executable. All .vcxproj files have been scripted and
are maintained by hand. It takes a long time to build in Release mode. If you
only need the libfst library, build it alone from the Project Explorer.
All build outputs are placed into the `build_output` directory under the
solution root.
### CMake
Follow the normal CMake build procedure to generate build files. With CMake you
have an option of building dynamic libraries shared by the executables.
## Limitations
* Memory-mapped files are not supported (we may add the support in the future
though), because it is very system-dependent. OpenFST supports reading e. g.
CompactFST files into allocated memoty when memory mapping is not compiled in.
* Dynamic registration of arc and FST types is not supported in the Visual Studio
project versions (as they build only static libraries). CMake build does not
have this limitation. Due to ABI being specific to Microsoft compiler version,
dynamically registered types must be compiled with strictly the same compiler
of the same major version, and mostly same build flags. This is quite hard to
get right, and is not recommended.
## Structure of the repository and tagging
The `original` branch contains only imported original OpenFST files, with one
exception of .gitignore file added. Tags of the form `orig/1.6.9.1` specify the
version and revision number of the library. Every commit on the `orignal` branch
contains the source URL for the tarball release of OpenFST that was committed.
The last version point corresponds to the revision of OpenFST version. Most (but
not all) of the versions has had only one revision, and therefore end in `.1`.
The `winport` branch contains the port, with corresponding tags of the form
`win/1.6.9.1`.
You can review the changes to source code only with the git command e. g.
`git diff orig/1.6.9.1..win/1.6.9.1 -- "*.cc" "*.h"`
The GitHub interface does not provide filtering by extension, so you will see
all CMakefiles and MSBuild files added, but it may be useful if you want to
examine changes in a particular file.
We try to keep changes to an absolute minimum. Most of them are due to
incompatibilities between the gcc and cl compilers, and only a minor portion
is due to the differences between the Linux and Windows platforms.
## Maintainers
The repository is maintained by [@kkm000](https://github.com/kkm000) and
[@jtrmal](https://github.com/jtrmal).
Open an issue to let us know if you discover a problem with the port. We react
to them promptly. Be sure to include a problem description, error text id any,
and the compiler or Visual Studio version (and CMake version, if you use it).
Do not hesitate to ask questions. We will try to help you.
Since we do not (by the definition of port) extend the OpenFST library itself,
please contact its authors with questions and suggestions related to the
original library. If in doubt, contact both teams.
Also let us know if you have a related development that you believe should be
linked to from this file.
---
_Copyright (c) 2008-current Google Inc._
_Copyright (c) 2016-current SmartAction LLC (kkm)_
_Copyright (c) 2016-current Johns Hopkins University (J. Trmal)_
@@ -0,0 +1,83 @@
#!/bin/bash
# This is a port port maintainer's file, and is not part of OpenFST.
# Licensed under the same Apache 2.0 license (see the file COPYING),
# or just delete it if in legal doubt; you do not need it anyway.
# Copyright 2019 SmartAction LLC.
set -euo pipefail; shopt -s extglob
LF=$'\n'
say() { echo >&2 "$0: $@"; }
die() { echo >&2 "$0: error: $@"; exit 1; }
# This is Spar^H^H Windooows!
miss=(); for tool in gawk git grep gzip tar wget; do
command -v $tool >/dev/null || miss+=($tool)
done
test ${#miss[@]} -eq 0 || die "missing required program(s): ${miss[@]}"
unset miss
[[ "$#" == [12] ]] || {
echo >&2 -e "Usage: $0 <version> [<revision>=1]${LF} e.g.: $0 1.7.0 1"
exit 2; }
ver=$1
rev=${2:-1}
tag="orig/$ver.$rev"
url="http://www.openfst.org/twiki/bin/viewfile/FST/FstDownload?filename=openfst-${ver}.tar.gz;rev=${rev}"
grep -qP '^1(\.1?\d){3}$' <<<"$ver.$rev" ||
die "revision $ver.$rev does not look correct to me"
pfx="$(git rev-parse --show-prefix)" && test -z "$pfx" ||
die "must be in the root of the work tree"
# Must be on the 'original' branch, in sync with the main repo,
# and with no local changes, although we can ignore deletions,
# since we are deleting files before import anyway. We must be
# squeaky clean, lest stray random files be added. Also, ignore
# changes to this file to allow for debugging.
git fetch origin
git status --porcelain=2 --branch | gawk -v me=$0 >&2 '
$0 == "# branch.head original" { branch_ok = 1 }
$1$2 == "#branch.ab" { ab_bad = $4 != "-0" }
$1 == "#" { next }
$1$2 == "1.D" { next } # Deleted files are fine.
$1$9 == "1_import_release.sh" { next }
{ modf_bad=1; nextfile }
END {
me = me ": error: "
if (!branch_ok) print me "current branch must be \"original\""
if (ab_bad) print me "current branch is not in sync with remote"
if (modf_bad) print me "there are locally modified files"
exit !(branch_ok && !ab_bad && !modf_bad) }'
git rev-parse -q --verify "refs/tags/$tag" >/dev/null &&
die "tag $tag already exists"
say "Removing (almost) all files from worktree"
rm -rf -- !(.|..|.git|.gitignore|_import_release.sh)
say "Fetching and unpacking OpenFST v$ver r$rev${LF} ... from: $url"
wget -nv -O - -- "$url" | tar -xzf - --strip-components=1
test -f NEWS ||
die "file NEWS was not unpacked. Something went horribly wrong."
message="Import v$ver r$rev${LF}${LF}$url"
say "committing and tagging new version"
git add -A
git commit -m "$message"
git tag -a "$tag" -m "$message"
say "summary of changes to the previous version, and a NEWS snippet"
git --no-pager show --stat
echo
git --no-pager show --format='' --unified=1 -w -- NEWS
echo
say "tag ${tag} created for the imported version. Import complete."
@@ -0,0 +1,50 @@
@echo off
setlocal enableextensions
:: Locate winrar.exe
set winrar="%ProgramFiles%\winrar\winrar.exe"
if not exist %winrar% set winrar="%ProgramFiles(x86)%\winrar\winrar.exe"
if not exist %winrar% (
echo ERROR: Cannot find winrar.exe 1>&2
exit /b 1
)
:: Get head tag and make sure it is sane.
for /f %%i in ('git describe --long --dirty') do set longtag=%%i
set insane=0
if not %longtag:-dirty=%.==%longtag%. set insane=1
if %longtag:-0-g=%.==%longtag%. set insane=1
if %longtag:win/=%.==%longtag%. set insane=1
if %insane%==1 (
echo ERROR: Best HEAD description '%longtag%' is not at a clean tag on winport branch 1>&2
exit /b 1
)
:: Get short description now, strip "win/" for version only
for /f %%i in ('git describe') do set tag=%%i
set tag=%tag:win/=%
:: Create archive with a comment
set cmtfile=%TEMP%\openfst-package-comment.txt
del /q %cmtfile% 2>nul
echo OpenFST binaries for Windows x64, optimized build. >>%cmtfile%
echo Copyright 2005-2019 Google, Inc. (Original source). >>%cmtfile%
echo Copyright 2016-2019 SmartAction LLC (Windows port). >>%cmtfile%
echo Copyright 2016-2019 Johns Hopkins Uni (Windows port). >>%cmtfile%
echo.>>%cmtfile%
echo OpenFST home page: http://www.openfst.org/ >>%cmtfile%
echo Git Repository: https://github.com/kkm000/openfst/ >>%cmtfile%
echo Build tag: %longtag% >>%cmtfile%
set zipfile=openfst-bin-win-x64-%tag%.zip
del /q %zipfile% 2>nul
%winrar% a -ep -m5 -z%cmtfile% %zipfile% NEWS COPYING build_output\x64\Release\bin\*.exe
if errorlevel 1 (
echo "ERROR: Cannot create archive '%zipfile%' 1>&2
del /q %cmtfile% 2>nul
exit /b 1
)
echo SUCCESS: Created archive '%zipfile%' 1>&2
del /q %cmtfile% 2>nul
exit /b 0
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+61
View File
@@ -0,0 +1,61 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
File diff suppressed because it is too large Load Diff
+180
View File
@@ -0,0 +1,180 @@
AC_INIT([OpenFst], [1.7.2], [help@www.openfst.org])
AM_INIT_AUTOMAKE([foreign nostdinc -Wall -Werror subdir-objects])
AM_PROG_AR
# OpenFst does not throw exceptions, so we do not generate exception handling
# code. However, users are free to re-enable exception handling.
# OpenFst assumes char is unsigned; -fsigned-char is likely unsafe.
CPPFLAGS="$CPPFLAGS -fno-exceptions -funsigned-char"
CXXFLAGS="$CXXFLAGS -std=c++11"
AC_PROG_CXX
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_CONFIG_HEADERS([config.h src/include/fst/config.h])
AC_CONFIG_SRCDIR([src/lib/fst.cc])
AC_CONFIG_FILES([
Makefile
src/Makefile
src/include/Makefile
src/lib/Makefile
src/bin/Makefile
src/test/Makefile
src/extensions/Makefile
src/extensions/compact/Makefile
src/extensions/compress/Makefile
src/extensions/const/Makefile
src/extensions/far/Makefile
src/extensions/linear/Makefile
src/extensions/lookahead/Makefile
src/extensions/mpdt/Makefile
src/extensions/ngram/Makefile
src/extensions/pdt/Makefile
src/extensions/python/Makefile
src/extensions/special/Makefile
src/script/Makefile
])
AC_CONFIG_MACRO_DIR([m4])
AC_LANG([C++])
AC_ARG_ENABLE([compact-fsts],
[AS_HELP_STRING([--enable-compact-fsts],
[enable CompactFst extensions])],
[],
[enable_compact_fsts=no])
AM_CONDITIONAL([HAVE_COMPACT], [test "x$enable_compact_fsts" != xno])
AC_ARG_ENABLE([compress],
[AS_HELP_STRING([--enable-compress],
[enable compression extension])],
[],
[enable_compress=no])
AM_CONDITIONAL([HAVE_COMPRESS], [test "x$enable_compress" != xno])
AC_ARG_ENABLE([const-fsts],
[AS_HELP_STRING([--enable-const-fsts],
[enable ConstFst extensions])],
[],
[enable_const_fsts=no])
AM_CONDITIONAL([HAVE_CONST], [test "x$enable_const_fsts" != xno])
AC_ARG_ENABLE([far],
[AS_HELP_STRING([--enable-far], [enable FAR extensions])],
[],
[enable_far=no])
AM_CONDITIONAL([HAVE_FAR], [test "x$enable_far" != xno])
AC_ARG_ENABLE([linear-fsts],
[AS_HELP_STRING([--enable-linear-fsts],
[enable LinearTagger/ClassifierFst extensions])],
[],
[enable_linear_fsts=no])
AM_CONDITIONAL([HAVE_LINEAR], [test "x$enable_linear_fsts" != xno])
AC_ARG_ENABLE([lookahead-fsts],
[AS_HELP_STRING([--enable-lookahead-fsts],
[enable LookAheadFst extensions])],
[],
[enable_lookahead_fsts=no])
AM_CONDITIONAL([HAVE_LOOKAHEAD], [test "x$enable_lookahead_fsts" != xno])
AC_ARG_ENABLE([mpdt],
[AS_HELP_STRING([--enable-mpdt],
[enable MPDT extensions])],
[],
[enable_mpdt=no])
AM_CONDITIONAL([HAVE_MPDT], [test "x$enable_mpdt" != xno])
AC_ARG_ENABLE([ngram-fsts],
[AS_HELP_STRING([--enable-ngram-fsts],
[enable NGramFst extension])],
[],
[enable_ngram_fsts=no])
AM_CONDITIONAL([HAVE_NGRAM], [test "x$enable_ngram_fsts" != xno])
AC_ARG_ENABLE([pdt],
[AS_HELP_STRING([--enable-pdt],
[enable PDT extensions])],
[],
[enable_pdt=no])
AM_CONDITIONAL([HAVE_PDT], [test "x$enable_pdt" != xno])
AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python],
[enable Python extensions])],
[],
[enable_python=no])
AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" != xno])
if test "x$enable_python" != xno; then
AM_PATH_PYTHON(2.7)
AC_PYTHON_DEVEL([>= '2.7'])
fi
AC_ARG_ENABLE([special],
[AS_HELP_STRING([--enable-special],
[enable special-matcher extensions])],
[],
[enable_special=no])
AM_CONDITIONAL([HAVE_SPECIAL], [test "x$enable_special" != xno])
# --enable-bin enables script and bin "extensions".
AC_ARG_ENABLE([bin],
[AS_HELP_STRING([--enable-bin],
[enable fst::script and command-line binaries])],
[],
[enable_bin=yes])
AM_CONDITIONAL([HAVE_BIN], [test "x$enable_bin" != xno])
AM_CONDITIONAL([HAVE_SCRIPT], [test "x$enable_bin" != xno])
# --enable-grm enables dependencies of OpenGrm: far, mpdt, and pdt.
AC_ARG_ENABLE([grm],
[AS_HELP_STRING([--enable-grm],
[enable all dependencies of OpenGrm])],
[],
[enable_grm=no])
AM_CONDITIONAL([HAVE_GRM], [test "x$enable_grm" != xno])
AC_ARG_WITH([libfstdir],
[--with-libfstdir[=DIR] fst dynamic extensions [[LIBDIR/fst]]],
[], [with_libfstdir=[${libdir}/fst]])
AC_SUBST([libfstdir], $with_libfstdir)
# Flags may be changed after configuring, so this is checked again by
# weight_test.cc. The check here is to save time in the common case,
# or when someone does not run `make check`.
AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <cstdio>
template <typename T>
bool FloatEqIsReflexive(T m) {
volatile T x = 1.111;
x *= m;
T y = 1.111;
y *= m;
return x == y;
}
], [
volatile double test_value = 1.1;
if (!FloatEqIsReflexive(static_cast<float>(test_value))) {
printf("float FAIL\n");
return 1;
}
if (!FloatEqIsReflexive(test_value)) {
printf("double FAIL\n");
return 1;
}
])],
[echo "Float equality is good"],
[AC_MSG_FAILURE(m4_normalize([
Test float equality failed!
Compile with -msse -mfpmath=sse if using g++.
]))])
AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
AC_SUBST([DL_LIBS])
AC_OUTPUT
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,230 @@
dnl @synopsis AC_PYTHON_DEVEL([version])
dnl
dnl Note: Defines as a precious variable "PYTHON_VERSION". Don't
dnl override it in your configure.ac.
dnl
dnl This macro checks for Python and tries to get the include path to
dnl 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and
dnl $(PYTHON_LDFLAGS) output variables. It also exports
dnl $(PYTHON_EXTRA_LIBS) and $(PYTHON_EXTRA_LDFLAGS) for embedding
dnl Python in your code.
dnl
dnl You can search for some particular version of Python by passing a
dnl parameter to this macro, for example ">= '2.3.1'", or "== '2.4'".
dnl Please note that you *have* to pass also an operator along with the
dnl version to match, and pay special attention to the single quotes
dnl surrounding the version number. Don't use "PYTHON_VERSION" for
dnl this: that environment variable is declared as precious and thus
dnl reserved for the end-user.
dnl
dnl This macro should work for all versions of Python >= 2.1.0. As an
dnl end user, you can disable the check for the python version by
dnl setting the PYTHON_NOVERSIONCHECK environment variable to something
dnl else than the empty string.
dnl
dnl If you need to use this macro for an older Python version, please
dnl contact the authors. We're always open for feedback.
dnl
dnl @category InstalledPackages
dnl @author Sebastian Huber <sebastian-huber@web.de>
dnl @author Alan W. Irwin <irwin@beluga.phys.uvic.ca>
dnl @author Rafael Laboissiere <laboissiere@psy.mpg.de>
dnl @author Andrew Collier <colliera@nu.ac.za>
dnl @author Matteo Settenvini <matteo@member.fsf.org>
dnl @author Horst Knorr <hk_classes@knoda.org>
dnl @version 2006-05-27
dnl @license GPLWithACException
AC_DEFUN([AC_PYTHON_DEVEL],[
#
# Allow the use of a (user set) custom python version
#
AC_ARG_VAR([PYTHON_VERSION],[The installed Python
version to use, for example '2.3'. This string
will be appended to the Python interpreter
canonical name.])
AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
if test -z "$PYTHON"; then
AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
PYTHON_VERSION=""
fi
#
# Check for a version of Python >= 2.1.0
#
AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
ac_supports_python_ver=`$PYTHON -c "import sys, string; \
ver = string.split(sys.version)[[0]]; \
print ver >= '2.1.0'"`
if test "$ac_supports_python_ver" != "True"; then
if test -z "$PYTHON_NOVERSIONCHECK"; then
AC_MSG_RESULT([no])
AC_MSG_FAILURE([
This version of the AC@&t@_PYTHON_DEVEL macro
doesn't work properly with versions of Python before
2.1.0. You may need to re-run configure, setting the
variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
to something else than an empty string.
])
else
AC_MSG_RESULT([skip at user request])
fi
else
AC_MSG_RESULT([yes])
fi
#
# if the macro parameter ``version'' is set, honour it
#
if test -n "$1"; then
AC_MSG_CHECKING([for a version of Python $1])
ac_supports_python_ver=`$PYTHON -c "import sys, string; \
ver = string.split(sys.version)[[0]]; \
print ver $1"`
if test "$ac_supports_python_ver" = "True"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([this package requires Python $1.
If you have it installed, but it isn't the default Python
interpreter in your system path, please pass the PYTHON_VERSION
variable to configure. See ``configure --help'' for reference.
])
PYTHON_VERSION=""
fi
fi
#
# Check if you have distutils, else fail
#
AC_MSG_CHECKING([for the distutils Python package])
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
if test -z "$ac_distutils_result"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot import Python module "distutils".
Please check your Python installation. The error was:
$ac_distutils_result])
PYTHON_VERSION=""
fi
#
# Check for Python include path
#
AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON_CPPFLAGS"; then
python_path=`$PYTHON -c "import distutils.sysconfig; \
print distutils.sysconfig.get_python_inc();"`
if test -n "${python_path}"; then
python_path="-I$python_path"
fi
PYTHON_CPPFLAGS=$python_path
fi
AC_MSG_RESULT([$PYTHON_CPPFLAGS])
AC_SUBST([PYTHON_CPPFLAGS])
#
# Check for Python library path
#
AC_MSG_CHECKING([for Python library path])
if test -z "$PYTHON_LDFLAGS"; then
# (makes two attempts to ensure we've got a version number
# from the interpreter)
py_version=`$PYTHON -c "from distutils.sysconfig import *; \
from string import join; \
print join(get_config_vars('VERSION'))"`
if test "$py_version" == "[None]"; then
if test -n "$PYTHON_VERSION"; then
py_version=$PYTHON_VERSION
else
py_version=`$PYTHON -c "import sys; \
print sys.version[[:3]]"`
fi
fi
PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
from string import join; \
print '-L' + get_python_lib(0,1), \
'-lpython';"`$py_version
fi
AC_MSG_RESULT([$PYTHON_LDFLAGS])
AC_SUBST([PYTHON_LDFLAGS])
#
# Check for site packages
#
AC_MSG_CHECKING([for Python site-packages path])
if test -z "$PYTHON_SITE_PKG"; then
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
print distutils.sysconfig.get_python_lib(0,0);"`
fi
AC_MSG_RESULT([$PYTHON_SITE_PKG])
AC_SUBST([PYTHON_SITE_PKG])
#
# libraries which must be linked in when embedding
#
AC_MSG_CHECKING(python extra libraries)
if test -z "$PYTHON_EXTRA_LIBS"; then
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \
print conf('LOCALMODLIBS'), conf('LIBS')"`
fi
AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
AC_SUBST(PYTHON_EXTRA_LIBS)
#
# linking flags needed when embedding
#
AC_MSG_CHECKING(python extra linking flags)
if test -z "$PYTHON_EXTRA_LDFLAGS"; then
PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \
print conf('LINKFORSHARED')"`
fi
AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
AC_SUBST(PYTHON_EXTRA_LDFLAGS)
#
# final check to see if everything compiles alright
#
AC_MSG_CHECKING([consistency of all components of python development environment])
AC_LANG_PUSH([C])
# save current global flags
LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
AC_TRY_LINK([
#include <Python.h>
],[
Py_Initialize();
],[pythonexists=yes],[pythonexists=no])
AC_MSG_RESULT([$pythonexists])
if test ! "$pythonexists" = "yes"; then
AC_MSG_ERROR([
Could not link test program to Python. Maybe the main Python library has been
installed in some non-standard library path. If so, pass it to configure,
via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
============================================================================
ERROR!
You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them.
============================================================================
])
PYTHON_VERSION=""
fi
AC_LANG_POP
# turn back to default flags
CPPFLAGS="$ac_save_CPPFLAGS"
LIBS="$ac_save_LIBS"
#
# all done!
#
])
File diff suppressed because it is too large Load Diff
+437
View File
@@ -0,0 +1,437 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 8 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option '$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
[_LT_WITH_AIX_SONAME([aix])])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the 'shared' and
# 'disable-shared' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the 'static' and
# 'disable-static' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the 'fast-install'
# and 'disable-fast-install' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_AIX_SONAME([DEFAULT])
# ----------------------------------
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
m4_define([_LT_WITH_AIX_SONAME],
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
shared_archive_member_spec=
case $host,$enable_shared in
power*-*-aix[[5-9]]*,yes)
AC_MSG_CHECKING([which variant of shared library versioning to provide])
AC_ARG_WITH([aix-soname],
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
[case $withval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
;;
esac
lt_cv_with_aix_soname=$with_aix_soname],
[AC_CACHE_VAL([lt_cv_with_aix_soname],
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
with_aix_soname=$lt_cv_with_aix_soname])
AC_MSG_RESULT([$with_aix_soname])
if test aix != "$with_aix_soname"; then
# For the AIX way of multilib, we name the shared archive member
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
# the AIX toolchain works better with OBJECT_MODE set (default 32).
if test 64 = "${OBJECT_MODE-32}"; then
shared_archive_member_spec=shr_64
else
shared_archive_member_spec=shr
fi
fi
;;
*)
with_aix_soname=aix
;;
esac
_LT_DECL([], [shared_archive_member_spec], [0],
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
])# _LT_WITH_AIX_SONAME
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
# LT_INIT options.
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $withval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[pic_mode=m4_default([$1], [default])])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])
+124
View File
@@ -0,0 +1,124 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59, which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])
+23
View File
@@ -0,0 +1,23 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 4179 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.6])
m4_define([LT_PACKAGE_REVISION], [2.4.6])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.6'
macro_revision='2.4.6'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
@@ -0,0 +1,99 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
+68
View File
@@ -0,0 +1,68 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfst", "src\lib\libfst.vcxproj", "{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Control and build files", "Control and build files", "{F14A9AF0-0D79-4553-AA8E-B3905A9B6431}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
src\openfst-multibin.targets = src\openfst-multibin.targets
src\openfst.props = src\openfst.props
src\openfst.targets = src\openfst.targets
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfstscript", "src\script\libfstscript.vcxproj", "{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bin", "src\bin\bin.vcxproj", "{84657A19-CAF2-49E8-8DB3-A428C19F460D}"
ProjectSection(ProjectDependencies) = postProject
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6} = {111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "!! READ ME BEFORE BUILD !!", "!! READ ME BEFORE BUILD !!", "{3BAF0BB0-34BF-4E28-BC17-A80D7CF4130F}"
ProjectSection(SolutionItems) = preProject
src\openfst.user.props = src\openfst.user.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Debug|x64.ActiveCfg = Debug|x64
{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Debug|x64.Build.0 = Debug|x64
{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Debug|x86.ActiveCfg = Debug|Win32
{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Debug|x86.Build.0 = Debug|Win32
{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Release|x64.ActiveCfg = Release|x64
{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Release|x64.Build.0 = Release|x64
{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Release|x86.ActiveCfg = Release|Win32
{DE80EFEC-9ED9-4631-BD96-8568C31ED26D}.Release|x86.Build.0 = Release|Win32
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Debug|x64.ActiveCfg = Debug|x64
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Debug|x64.Build.0 = Debug|x64
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Debug|x86.ActiveCfg = Debug|Win32
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Debug|x86.Build.0 = Debug|Win32
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Release|x64.ActiveCfg = Release|x64
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Release|x64.Build.0 = Release|x64
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Release|x86.ActiveCfg = Release|Win32
{111F46ED-DA1F-469B-B912-BA2ACC2FF8E6}.Release|x86.Build.0 = Release|Win32
{84657A19-CAF2-49E8-8DB3-A428C19F460D}.Debug|x64.ActiveCfg = Debug|x64
{84657A19-CAF2-49E8-8DB3-A428C19F460D}.Debug|x64.Build.0 = Debug|x64
{84657A19-CAF2-49E8-8DB3-A428C19F460D}.Debug|x86.ActiveCfg = Debug|Win32
{84657A19-CAF2-49E8-8DB3-A428C19F460D}.Debug|x86.Build.0 = Debug|Win32
{84657A19-CAF2-49E8-8DB3-A428C19F460D}.Release|x64.ActiveCfg = Release|x64
{84657A19-CAF2-49E8-8DB3-A428C19F460D}.Release|x64.Build.0 = Release|x64
{84657A19-CAF2-49E8-8DB3-A428C19F460D}.Release|x86.ActiveCfg = Release|Win32
{84657A19-CAF2-49E8-8DB3-A428C19F460D}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {14CFFA93-2ED0-43D3-A3E9-5203D4CB19BF}
EndGlobalSection
EndGlobal
@@ -0,0 +1,23 @@
#-DHAVE_CONFIG_H -I./../include -fno-exceptions -funsigned-char -std=c++11 -MT symbol-table.lo -MD -MP -MF .deps/symbol-table.Tpo -c symbol-table.cc -fno-common -DPIC -o .libs/symbol-table.o
include_directories(./include/)
install(DIRECTORY include/ DESTINATION include/
FILES_MATCHING PATTERN "*.h")
add_subdirectory(lib)
if(HAVE_SCRIPT)
add_subdirectory(script)
endif(HAVE_SCRIPT)
if(HAVE_BIN)
add_subdirectory(bin)
endif(HAVE_BIN)
add_subdirectory(extensions)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif(BUILD_TESTING)
@@ -0,0 +1 @@
SUBDIRS = include lib script bin test extensions
+638
View File
@@ -0,0 +1,638 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_python_devel.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/src/include/fst/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PYTHON = @PYTHON@
PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
libfstdir = @libfstdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = include lib script bin test extensions
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
check-am clean clean-generic clean-libtool cscopelist-am ctags \
ctags-am distclean distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
@@ -0,0 +1,86 @@
function (add_executable2 _name)
add_executable(${ARGV})
if (TARGET ${_name})
target_link_libraries(${_name} fstscript fst ${CMAKE_DL_LIBS})
set_target_properties(${_name} PROPERTIES FOLDER bin)
endif()
install(TARGETS ${_name} RUNTIME DESTINATION bin)
endfunction()
include_directories(../include ../script/)
add_executable2(fstarcsort fstarcsort-main.cc fstarcsort.cc)
add_executable2(fstclosure fstclosure-main.cc fstclosure.cc)
add_executable2(fstcompile fstcompile-main.cc fstcompile.cc)
add_executable2(fstcompose fstcompose-main.cc fstcompose.cc)
add_executable2(fstconcat fstconcat-main.cc fstconcat.cc)
add_executable2(fstconnect fstconnect-main.cc fstconnect.cc)
add_executable2(fstconvert fstconvert-main.cc fstconvert.cc)
add_executable2(fstdeterminize fstdeterminize-main.cc fstdeterminize.cc)
add_executable2(fstdifference fstdifference-main.cc fstdifference.cc)
add_executable2(fstdisambiguate fstdisambiguate-main.cc fstdisambiguate.cc)
add_executable2(fstdraw fstdraw-main.cc fstdraw.cc)
add_executable2(fstencode fstencode-main.cc fstencode.cc)
add_executable2(fstepsnormalize fstepsnormalize-main.cc fstepsnormalize.cc)
add_executable2(fstequal fstequal-main.cc fstequal.cc)
add_executable2(fstequivalent fstequivalent-main.cc fstequivalent.cc)
add_executable2(fstinfo fstinfo-main.cc fstinfo.cc)
add_executable2(fstintersect fstintersect-main.cc fstintersect.cc)
add_executable2(fstinvert fstinvert-main.cc fstinvert.cc)
add_executable2(fstisomorphic fstisomorphic-main.cc fstisomorphic.cc)
add_executable2(fstmap fstmap-main.cc fstmap.cc)
add_executable2(fstminimize fstminimize-main.cc fstminimize.cc)
add_executable2(fstprint fstprint-main.cc fstprint.cc)
add_executable2(fstproject fstproject-main.cc fstproject.cc)
add_executable2(fstprune fstprune-main.cc fstprune.cc)
add_executable2(fstpush fstpush-main.cc fstpush.cc)
add_executable2(fstrandgen fstrandgen-main.cc fstrandgen.cc)
add_executable2(fstrelabel fstrelabel-main.cc fstrelabel.cc)
add_executable2(fstreplace fstreplace-main.cc fstreplace.cc)
add_executable2(fstreverse fstreverse-main.cc fstreverse.cc)
add_executable2(fstreweight fstreweight-main.cc fstreweight.cc)
add_executable2(fstrmepsilon fstrmepsilon-main.cc fstrmepsilon.cc)
add_executable2(fstshortestdistance fstshortestdistance-main.cc fstshortestdistance.cc)
add_executable2(fstshortestpath fstshortestpath-main.cc fstshortestpath.cc)
add_executable2(fstsymbols fstsymbols-main.cc fstsymbols.cc)
add_executable2(fstsynchronize fstsynchronize-main.cc fstsynchronize.cc)
add_executable2(fsttopsort fsttopsort-main.cc fsttopsort.cc)
add_executable2(fstunion fstunion-main.cc fstunion.cc)
@@ -0,0 +1,86 @@
AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../script $(ICU_FLAGS)
LDADD = ../script/libfstscript.la ../lib/libfst.la -lm $(DL_LIBS)
if HAVE_BIN
bin_PROGRAMS = fstarcsort fstclosure fstcompile fstcompose fstconcat \
fstconnect fstconvert fstdeterminize fstdifference fstdisambiguate fstdraw \
fstencode fstepsnormalize fstequal fstequivalent fstinfo fstintersect \
fstinvert fstisomorphic fstmap fstminimize fstprint fstproject fstprune \
fstpush fstrandgen fstrelabel fstreplace fstreverse fstreweight fstrmepsilon \
fstshortestdistance fstshortestpath fstsymbols fstsynchronize fsttopsort \
fstunion
fstarcsort_SOURCES = fstarcsort.cc fstarcsort-main.cc
fstclosure_SOURCES = fstclosure.cc fstclosure-main.cc
fstcompile_SOURCES = fstcompile.cc fstcompile-main.cc
fstcompose_SOURCES = fstcompose.cc fstcompose-main.cc
fstconcat_SOURCES = fstconcat.cc fstconcat-main.cc
fstconnect_SOURCES = fstconnect.cc fstconnect-main.cc
fstconvert_SOURCES = fstconvert.cc fstconvert-main.cc
fstdeterminize_SOURCES = fstdeterminize.cc fstdeterminize-main.cc
fstdifference_SOURCES = fstdifference.cc fstdifference-main.cc
fstdisambiguate_SOURCES = fstdisambiguate.cc fstdisambiguate-main.cc
fstdraw_SOURCES = fstdraw.cc fstdraw-main.cc
fstencode_SOURCES = fstencode.cc fstencode-main.cc
fstepsnormalize_SOURCES = fstepsnormalize.cc fstepsnormalize-main.cc
fstequal_SOURCES = fstequal.cc fstequal-main.cc
fstequivalent_SOURCES = fstequivalent.cc fstequivalent-main.cc
fstinfo_SOURCES = fstinfo.cc fstinfo-main.cc
fstintersect_SOURCES = fstintersect.cc fstintersect-main.cc
fstinvert_SOURCES = fstinvert.cc fstinvert-main.cc
fstisomorphic_SOURCES = fstisomorphic.cc fstisomorphic-main.cc
fstmap_SOURCES = fstmap.cc fstmap-main.cc
fstminimize_SOURCES = fstminimize.cc fstminimize-main.cc
fstprint_SOURCES = fstprint.cc fstprint-main.cc
fstproject_SOURCES = fstproject.cc fstproject-main.cc
fstprune_SOURCES = fstprune.cc fstprune-main.cc
fstpush_SOURCES = fstpush.cc fstpush-main.cc
fstrandgen_SOURCES = fstrandgen.cc fstrandgen-main.cc
fstrelabel_SOURCES = fstrelabel.cc fstrelabel-main.cc
fstreplace_SOURCES = fstreplace.cc fstreplace-main.cc
fstreverse_SOURCES = fstreverse.cc fstreverse-main.cc
fstreweight_SOURCES = fstreweight.cc fstreweight-main.cc
fstrmepsilon_SOURCES = fstrmepsilon.cc fstrmepsilon-main.cc
fstshortestdistance_SOURCES = fstshortestdistance.cc fstshortestdistance-main.cc
fstshortestpath_SOURCES = fstshortestpath.cc fstshortestpath-main.cc
fstsymbols_SOURCES = fstsymbols.cc fstsymbols-main.cc
fstsynchronize_SOURCES = fstsynchronize.cc fstsynchronize-main.cc
fsttopsort_SOURCES = fsttopsort.cc fsttopsort-main.cc
fstunion_SOURCES = fstunion.cc fstunion-main.cc
endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,27 @@
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Need ConfigurationType set before importing openfst.props!
-->
<PropertyGroup Label="Globals">
<ProjectGuid>{84657A19-CAF2-49E8-8DB3-A428C19F460D}</ProjectGuid>
<ConfigurationType>Application</ConfigurationType>
<MultiBin>true</MultiBin>
</PropertyGroup>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Import Project="../openfst.props" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<ItemGroup>
<ClCompile Include="*.cc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\lib\libfst.vcxproj">
<Project>{de80efec-9ed9-4631-bd96-8568c31ed26d}</Project>
</ProjectReference>
<ProjectReference Include="..\script\libfstscript.vcxproj">
<Project>{111f46ed-da1f-469b-b912-ba2acc2ff8e6}</Project>
</ProjectReference>
</ItemGroup>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Import Project="../openfst.targets" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</Project>
@@ -0,0 +1,51 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Sorts arcs of an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/arcsort.h>
#include <fst/script/getters.h>
DECLARE_string(sort_type);
int fstarcsort_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
string usage = "Sorts arcs of an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name =
(argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
s::ArcSortType sort_type;
if (!s::GetArcSortType(FLAGS_sort_type, &sort_type)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported sort type: "
<< FLAGS_sort_type;
return 1;
}
s::ArcSort(fst.get(), sort_type);
return !fst->Write(out_name);
}
@@ -0,0 +1,12 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/compat.h>
#include <fst/flags.h>
DEFINE_string(sort_type, "ilabel",
"Comparison method, one of: \"ilabel\", \"olabel\"");
int fstarcsort_main(int argc, char **argv);
int main(int argc, char **argv) { return fstarcsort_main(argc, argv); }
@@ -0,0 +1,41 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Creates the Kleene closure of an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/closure.h>
#include <fst/script/getters.h>
DECLARE_bool(closure_plus);
int fstclosure_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
string usage = "Creates the Kleene closure of an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
s::Closure(fst.get(), s::GetClosureType(FLAGS_closure_plus));
return !fst->Write(out_name);
}
@@ -0,0 +1,11 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(closure_plus, false,
"Do not add the empty path (T+ instead of T*)?");
int fstclosure_main(int argc, char **argv);
int main(int argc, char **argv) { return fstclosure_main(argc, argv); }
@@ -0,0 +1,84 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Creates binary FSTs from simple text format used by AT&T.
#include <cstring>
#include <fstream>
#include <istream>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/compile.h>
DECLARE_bool(acceptor);
DECLARE_string(arc_type);
DECLARE_string(fst_type);
DECLARE_string(isymbols);
DECLARE_string(osymbols);
DECLARE_string(ssymbols);
DECLARE_bool(keep_isymbols);
DECLARE_bool(keep_osymbols);
DECLARE_bool(keep_state_numbering);
DECLARE_bool(allow_negative_labels);
int fstcompile_main(int argc, char **argv) {
namespace s = fst::script;
using fst::SymbolTable;
using fst::SymbolTableTextOptions;
string usage = "Creates binary FSTs from simple text format.\n\n Usage: ";
usage += argv[0];
usage += " [text.fst [binary.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
string source = "standard input";
std::ifstream fstrm;
if (argc > 1 && strcmp(argv[1], "-") != 0) {
fstrm.open(argv[1]);
if (!fstrm) {
LOG(ERROR) << argv[0] << ": Open failed, file = " << argv[1];
return 1;
}
source = argv[1];
}
std::istream &istrm = fstrm.is_open() ? fstrm : std::cin;
const SymbolTableTextOptions opts(FLAGS_allow_negative_labels);
std::unique_ptr<const SymbolTable> isyms;
if (!FLAGS_isymbols.empty()) {
isyms.reset(SymbolTable::ReadText(FLAGS_isymbols, opts));
if (!isyms) return 1;
}
std::unique_ptr<const SymbolTable> osyms;
if (!FLAGS_osymbols.empty()) {
osyms.reset(SymbolTable::ReadText(FLAGS_osymbols, opts));
if (!osyms) return 1;
}
std::unique_ptr<const SymbolTable> ssyms;
if (!FLAGS_ssymbols.empty()) {
ssyms.reset(SymbolTable::ReadText(FLAGS_ssymbols));
if (!ssyms) return 1;
}
const string dest = argc > 2 ? argv[2] : "";
s::CompileFst(istrm, source, dest, FLAGS_fst_type, FLAGS_arc_type,
isyms.get(), osyms.get(), ssyms.get(), FLAGS_acceptor,
FLAGS_keep_isymbols, FLAGS_keep_osymbols,
FLAGS_keep_state_numbering, FLAGS_allow_negative_labels);
return 0;
}
@@ -0,0 +1,20 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(acceptor, false, "Input in acceptor format");
DEFINE_string(arc_type, "standard", "Output arc type");
DEFINE_string(fst_type, "vector", "Output FST type");
DEFINE_string(isymbols, "", "Input label symbol table");
DEFINE_string(osymbols, "", "Output label symbol table");
DEFINE_string(ssymbols, "", "State label symbol table");
DEFINE_bool(keep_isymbols, false, "Store input label symbol table with FST");
DEFINE_bool(keep_osymbols, false, "Store output label symbol table with FST");
DEFINE_bool(keep_state_numbering, false, "Do not renumber input states");
DEFINE_bool(allow_negative_labels, false,
"Allow negative labels (not recommended; may cause conflicts)");
int fstcompile_main(int argc, char **argv);
int main(int argc, char **argv) { return fstcompile_main(argc, argv); }
@@ -0,0 +1,72 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Composes two FSTs.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/compose.h>
#include <fst/script/getters.h>
DECLARE_string(compose_filter);
DECLARE_bool(connect);
int fstcompose_main(int argc, char **argv) {
namespace s = fst::script;
using fst::ComposeFilter;
using fst::ComposeOptions;
using fst::script::FstClass;
using fst::script::VectorFstClass;
string usage = "Composes two FSTs.\n\n Usage: ";
usage += argv[0];
usage += " in1.fst in2.fst [out.fst]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc < 3 || argc > 4) {
ShowUsage();
return 1;
}
const string in1_name = strcmp(argv[1], "-") != 0 ? argv[1] : "";
const string in2_name =
(argc > 2 && (strcmp(argv[2], "-") != 0)) ? argv[2] : "";
const string out_name = argc > 3 ? argv[3] : "";
if (in1_name.empty() && in2_name.empty()) {
LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input";
return 1;
}
std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
if (!ifst1) return 1;
std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
if (!ifst2) return 1;
if (ifst1->ArcType() != ifst2->ArcType()) {
LOG(ERROR) << argv[0] << ": Input FSTs must have the same arc type";
return 1;
}
VectorFstClass ofst(ifst1->ArcType());
ComposeFilter compose_filter;
if (!s::GetComposeFilter(FLAGS_compose_filter, &compose_filter)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported compose filter type: "
<< FLAGS_compose_filter;
return 1;
}
const ComposeOptions opts(FLAGS_connect, compose_filter);
s::Compose(*ifst1, *ifst2, &ofst, opts);
return !ofst.Write(out_name);
}
@@ -0,0 +1,13 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_string(compose_filter, "auto",
"Composition filter, one of: \"alt_sequence\", \"auto\", "
"\"match\", \"no_match\", \"null\", \"sequence\", \"trivial\"");
DEFINE_bool(connect, true, "Trim output");
int fstcompose_main(int argc, char **argv);
int main(int argc, char **argv) { return fstcompose_main(argc, argv); }
@@ -0,0 +1,49 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Concatenates two FSTs.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/concat.h>
int fstconcat_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::MutableFstClass;
string usage = "Concatenates two FSTs.\n\n Usage: ";
usage += argv[0];
usage += " in1.fst in2.fst [out.fst]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc < 3 || argc > 4) {
ShowUsage();
return 1;
}
const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1];
const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2];
const string out_name = argc > 3 ? argv[3] : "";
if (in1_name.empty() && in2_name.empty()) {
LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input";
return 1;
}
std::unique_ptr<MutableFstClass> fst1(MutableFstClass::Read(in1_name, true));
if (!fst1) return 1;
std::unique_ptr<FstClass> fst2(FstClass::Read(in2_name));
if (!fst2) return 1;
s::Concat(fst1.get(), *fst2);
return !fst1->Write(out_name);
}
@@ -0,0 +1,6 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
int fstconcat_main(int argc, char **argv);
int main(int argc, char **argv) { return fstconcat_main(argc, argv); }
@@ -0,0 +1,40 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Removes useless (inaccessible or non-coaccessible) states and arcs from an
// FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/connect.h>
int fstconnect_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::MutableFstClass;
string usage = "Removes useless states and arcs from an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
s::Connect(fst.get());
return !fst->Write(out_name);
}
@@ -0,0 +1,6 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
int fstconnect_main(int argc, char **argv);
int main(int argc, char **argv) { return fstconnect_main(argc, argv); }
@@ -0,0 +1,44 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Converts an FST to another type.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/convert.h>
DECLARE_string(fst_type);
int fstconvert_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
string usage = "Converts an FST to another type.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
if (ifst->FstType() != FLAGS_fst_type) {
std::unique_ptr<FstClass> ofst(s::Convert(*ifst, FLAGS_fst_type));
if (!ofst) return 1;
return !ofst->Write(out_name);
} else {
return !ifst->Write(out_name);
}
}
@@ -0,0 +1,10 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_string(fst_type, "vector", "Output FST type");
int fstconvert_main(int argc, char **argv);
int main(int argc, char **argv) { return fstconvert_main(argc, argv); }
@@ -0,0 +1,66 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Determinizes an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/determinize.h>
#include <fst/script/getters.h>
DECLARE_double(delta);
DECLARE_string(weight);
DECLARE_int64(nstate);
DECLARE_int64(subsequential_label);
DECLARE_string(det_type);
DECLARE_bool(increment_subsequential_label);
int fstdeterminize_main(int argc, char **argv) {
namespace s = fst::script;
using fst::DeterminizeType;
using fst::script::FstClass;
using fst::script::VectorFstClass;
using fst::script::WeightClass;
string usage = "Determinizes an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
DeterminizeType det_type;
if (!s::GetDeterminizeType(FLAGS_det_type, &det_type)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported determinization type: "
<< FLAGS_det_type;
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
VectorFstClass ofst(ifst->ArcType());
const auto weight_threshold =
FLAGS_weight.empty() ? WeightClass::Zero(ifst->WeightType())
: WeightClass(ifst->WeightType(), FLAGS_weight);
const s::DeterminizeOptions opts(FLAGS_delta, weight_threshold, FLAGS_nstate,
FLAGS_subsequential_label, det_type,
FLAGS_increment_subsequential_label);
s::Determinize(*ifst, &ofst, opts);
return !ofst.Write(out_name);
}
@@ -0,0 +1,23 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/fst.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta");
DEFINE_string(weight, "", "Weight threshold");
DEFINE_int64(nstate, fst::kNoStateId, "State number threshold");
DEFINE_int64(subsequential_label, 0,
"Input label of arc corresponding to residual final output when"
" producing a subsequential transducer");
DEFINE_string(det_type, "functional",
"Type of determinization: \"functional\", "
"\"nonfunctional\", \"disambiguate\"");
DEFINE_bool(increment_subsequential_label, false,
"Increment subsequential_label to obtain distinct labels for "
" subsequential arcs at a given state");
int fstdeterminize_main(int argc, char **argv);
int main(int argc, char **argv) { return fstdeterminize_main(argc, argv); }
@@ -0,0 +1,66 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Subtracts an unweighted DFA from an FSA.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/difference.h>
#include <fst/script/getters.h>
DECLARE_string(compose_filter);
DECLARE_bool(connect);
int fstdifference_main(int argc, char **argv) {
namespace s = fst::script;
using fst::ComposeFilter;
using fst::DifferenceOptions;
using fst::script::FstClass;
using fst::script::VectorFstClass;
string usage = "Subtracts an unweighted DFA from an FSA.\n\n Usage: ";
usage += argv[0];
usage += " in1.fst in2.fst [out.fst]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc < 3 || argc > 4) {
ShowUsage();
return 1;
}
const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1];
const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2];
const string out_name = argc > 3 ? argv[3] : "";
if (in1_name.empty() && in2_name.empty()) {
LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input";
return 1;
}
std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
if (!ifst1) return 1;
std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
if (!ifst2) return 1;
VectorFstClass ofst(ifst1->ArcType());
ComposeFilter compose_filter;
if (!s::GetComposeFilter(FLAGS_compose_filter, &compose_filter)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported compose filter type: "
<< FLAGS_compose_filter;
return 1;
}
const DifferenceOptions opts(FLAGS_connect, compose_filter);
s::Difference(*ifst1, *ifst2, &ofst, opts);
return !ofst.Write(out_name);
}
@@ -0,0 +1,13 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_string(compose_filter, "auto",
"Composition filter, one of: \"alt_sequence\", \"auto\", "
"\"match\", \"null\", \"sequence\", \"trivial\"");
DEFINE_bool(connect, true, "Trim output");
int fstdifference_main(int argc, char **argv);
int main(int argc, char **argv) { return fstdifference_main(argc, argv); }
@@ -0,0 +1,54 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Disambiguates an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/disambiguate.h>
DECLARE_double(delta);
DECLARE_int64(nstate);
DECLARE_string(weight);
DECLARE_int64(subsequential_label);
int fstdisambiguate_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::VectorFstClass;
using fst::script::WeightClass;
string usage = "Disambiguates an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
VectorFstClass ofst(ifst->ArcType());
const auto weight_threshold =
FLAGS_weight.empty() ? WeightClass::Zero(ifst->WeightType())
: WeightClass(ifst->WeightType(), FLAGS_weight);
const s::DisambiguateOptions opts(FLAGS_delta, weight_threshold, FLAGS_nstate,
FLAGS_subsequential_label);
s::Disambiguate(*ifst, &ofst, opts);
return !ofst.Write(out_name);
}
@@ -0,0 +1,17 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/fst.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta");
DEFINE_int64(nstate, fst::kNoStateId, "State number threshold");
DEFINE_string(weight, "", "Weight threshold");
DEFINE_int64(subsequential_label, 0,
"Input label of arc corresponding to residual final output when"
" producing a subsequential transducer");
int fstdisambiguate_main(int argc, char **argv);
int main(int argc, char **argv) { return fstdisambiguate_main(argc, argv); }
@@ -0,0 +1,104 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Draws a binary FSTs in the Graphviz dot text format.
#include <cstring>
#include <fstream>
#include <memory>
#include <ostream>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/draw.h>
DECLARE_bool(acceptor);
DECLARE_string(isymbols);
DECLARE_string(osymbols);
DECLARE_string(ssymbols);
DECLARE_bool(numeric);
DECLARE_int32(precision);
DECLARE_string(float_format);
DECLARE_bool(show_weight_one);
DECLARE_string(title);
DECLARE_bool(portrait);
DECLARE_bool(vertical);
DECLARE_int32(fontsize);
DECLARE_double(height);
DECLARE_double(width);
DECLARE_double(nodesep);
DECLARE_double(ranksep);
DECLARE_bool(allow_negative_labels);
int fstdraw_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::SymbolTable;
using fst::SymbolTableTextOptions;
string usage = "Prints out binary FSTs in dot text format.\n\n Usage: ";
usage += argv[0];
usage += " [binary.fst [text.dot]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
std::unique_ptr<FstClass> fst(FstClass::Read(in_name));
if (!fst) return 1;
string dest = "stdout";
std::ofstream fstrm;
if (argc == 3) {
fstrm.open(argv[2]);
if (!fstrm) {
LOG(ERROR) << argv[0] << ": Open failed, file = " << argv[2];
return 1;
}
dest = argv[2];
}
std::ostream &ostrm = fstrm.is_open() ? fstrm : std::cout;
const SymbolTableTextOptions opts(FLAGS_allow_negative_labels);
std::unique_ptr<const SymbolTable> isyms;
if (!FLAGS_isymbols.empty() && !FLAGS_numeric) {
isyms.reset(SymbolTable::ReadText(FLAGS_isymbols, opts));
if (!isyms) return 1;
}
std::unique_ptr<const SymbolTable> osyms;
if (!FLAGS_osymbols.empty() && !FLAGS_numeric) {
osyms.reset(SymbolTable::ReadText(FLAGS_osymbols, opts));
if (!osyms) return 1;
}
std::unique_ptr<const SymbolTable> ssyms;
if (!FLAGS_ssymbols.empty() && !FLAGS_numeric) {
ssyms.reset(SymbolTable::ReadText(FLAGS_ssymbols));
if (!ssyms) return 1;
}
if (!isyms && !FLAGS_numeric && fst->InputSymbols()) {
isyms.reset(fst->InputSymbols()->Copy());
}
if (!osyms && !FLAGS_numeric && fst->OutputSymbols()) {
osyms.reset(fst->OutputSymbols()->Copy());
}
s::DrawFst(*fst, isyms.get(), osyms.get(), ssyms.get(), FLAGS_acceptor,
FLAGS_title, FLAGS_width, FLAGS_height, FLAGS_portrait,
FLAGS_vertical, FLAGS_ranksep, FLAGS_nodesep, FLAGS_fontsize,
FLAGS_precision, FLAGS_float_format, FLAGS_show_weight_one,
&ostrm, dest);
return 0;
}
@@ -0,0 +1,31 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(acceptor, false, "Input in acceptor format");
DEFINE_string(isymbols, "", "Input label symbol table");
DEFINE_string(osymbols, "", "Output label symbol table");
DEFINE_string(ssymbols, "", "State label symbol table");
DEFINE_bool(numeric, false, "Print numeric labels");
DEFINE_int32(precision, 5, "Set precision (number of char/float)");
DEFINE_string(float_format, "g",
"Floating-point format, one of: \"e\", \"f\", or \"g\"");
DEFINE_bool(show_weight_one, false,
"Print/draw arc weights and final weights equal to Weight::One()");
DEFINE_string(title, "", "Set figure title");
DEFINE_bool(portrait, false, "Portrait mode (def: landscape)");
DEFINE_bool(vertical, false, "Draw bottom-to-top instead of left-to-right");
DEFINE_int32(fontsize, 14, "Set fontsize");
DEFINE_double(height, 11, "Set height");
DEFINE_double(width, 8.5, "Set width");
DEFINE_double(nodesep, 0.25,
"Set minimum separation between nodes (see dot documentation)");
DEFINE_double(ranksep, 0.40,
"Set minimum separation between ranks (see dot documentation)");
DEFINE_bool(allow_negative_labels, false,
"Allow negative labels (not recommended; may cause conflicts)");
int fstdraw_main(int argc, char **argv);
int main(int argc, char **argv) { return fstdraw_main(argc, argv); }
@@ -0,0 +1,53 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Encode transducer labels and/or weights.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/decode.h>
#include <fst/script/encode.h>
#include <fst/script/getters.h>
DECLARE_bool(encode_labels);
DECLARE_bool(encode_weights);
DECLARE_bool(encode_reuse);
DECLARE_bool(decode);
int fstencode_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::MutableFstClass;
string usage = "Encodes transducer labels and/or weights.\n\n Usage: ";
usage += argv[0];
usage += " in.fst codex [out.fst]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc < 3 || argc > 4) {
ShowUsage();
return 1;
}
const string in_name = (strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string codex_name = argv[2];
const string out_name = argc > 3 ? argv[3] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
if (FLAGS_decode) {
s::Decode(fst.get(), codex_name);
return !fst->Write(out_name);
} else {
const auto flags =
s::GetEncodeFlags(FLAGS_encode_labels, FLAGS_encode_weights);
s::Encode(fst.get(), flags, FLAGS_encode_reuse, codex_name);
return !fst->Write(out_name);
}
}
@@ -0,0 +1,13 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(encode_labels, false, "Encode output labels");
DEFINE_bool(encode_weights, false, "Encode weights");
DEFINE_bool(encode_reuse, false, "Re-use existing codex");
DEFINE_bool(decode, false, "Decode labels and/or weights");
int fstencode_main(int argc, char **argv);
int main(int argc, char **argv) { return fstencode_main(argc, argv); }
@@ -0,0 +1,44 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Epsilon-normalizes an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/epsnormalize.h>
#include <fst/script/getters.h>
DECLARE_bool(eps_norm_output);
int fstepsnormalize_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::VectorFstClass;
string usage = "Epsilon normalizes an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
VectorFstClass ofst(ifst->ArcType());
s::EpsNormalize(*ifst, &ofst, s::GetEpsNormalizeType(FLAGS_eps_norm_output));
return !ofst.Write(out_name);
}
@@ -0,0 +1,10 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(eps_norm_output, false, "Normalize output epsilons");
int fstepsnormalize_main(int argc, char **argv);
int main(int argc, char **argv) { return fstepsnormalize_main(argc, argv); }
@@ -0,0 +1,50 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Two FSTS are equal iff their exit status is zero.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/equal.h>
DECLARE_double(delta);
int fstequal_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
string usage = "Two FSTs are equal iff the exit status is zero.\n\n Usage: ";
usage += argv[0];
usage += " in1.fst in2.fst\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc != 3) {
ShowUsage();
return 1;
}
const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1];
const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2];
if (in1_name.empty() && in2_name.empty()) {
LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input";
return 1;
}
std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
if (!ifst1) return 1;
std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
if (!ifst2) return 1;
bool result = s::Equal(*ifst1, *ifst2, FLAGS_delta);
if (!result) VLOG(1) << "FSTs are not equal.";
return result ? 0 : 2;
}
@@ -0,0 +1,11 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta");
int fstequal_main(int argc, char **argv);
int main(int argc, char **argv) { return fstequal_main(argc, argv); }
@@ -0,0 +1,73 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Two DFAs are equivalent iff their exit status is zero.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/equivalent.h>
#include <fst/script/getters.h>
#include <fst/script/randequivalent.h>
DECLARE_double(delta);
DECLARE_bool(random);
DECLARE_int32(max_length);
DECLARE_int32(npath);
DECLARE_int32(seed);
DECLARE_string(select);
int fstequivalent_main(int argc, char **argv) {
namespace s = fst::script;
using fst::RandGenOptions;
using fst::script::FstClass;
string usage =
"Two DFAs are equivalent iff the exit status is zero.\n\n"
" Usage: ";
usage += argv[0];
usage += " in1.fst in2.fst\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc != 3) {
ShowUsage();
return 1;
}
const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1];
const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2];
if (in1_name.empty() && in2_name.empty()) {
LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input";
return 1;
}
std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
if (!ifst1) return 1;
std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
if (!ifst2) return 1;
if (!FLAGS_random) {
bool result = s::Equivalent(*ifst1, *ifst2, FLAGS_delta);
if (!result) VLOG(1) << "FSTs are not equivalent";
return result ? 0 : 2;
} else {
s::RandArcSelection ras;
if (!s::GetRandArcSelection(FLAGS_select, &ras)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported select type "
<< FLAGS_select;
return 1;
}
const RandGenOptions<s::RandArcSelection> opts(ras, FLAGS_max_length);
bool result = s::RandEquivalent(*ifst1, *ifst2, FLAGS_npath, FLAGS_delta,
FLAGS_seed, opts);
if (!result) VLOG(1) << "FSTs are not equivalent";
return result ? 0 : 2;
}
}
@@ -0,0 +1,27 @@
#ifndef _MSC_VER
#include <unistd.h>
#else
#include <process.h>
#define getpid _getpid
#endif
#include <climits>
#include <ctime>
#include <fst/flags.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta");
DEFINE_bool(random, false,
"Test equivalence by randomly selecting paths in the input FSTs");
DEFINE_int32(max_length, INT32_MAX, "Maximum path length");
DEFINE_int32(npath, 1, "Number of paths to generate");
DEFINE_int32(seed, time(nullptr) + getpid(), "Random seed");
DEFINE_string(select, "uniform",
"Selection type: one of: "
" \"uniform\", \"log_prob\" (when appropriate),"
" \"fast_log_prob\" (when appropriate)");
int fstequivalent_main(int argc, char **argv);
int main(int argc, char **argv) { return fstequivalent_main(argc, argv); }
@@ -0,0 +1,46 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Prints out various information about an FST such as number of states
// and arcs and property values (see properties.h).
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/info.h>
DECLARE_string(arc_filter);
DECLARE_string(info_type);
DECLARE_bool(pipe);
DECLARE_bool(test_properties);
DECLARE_bool(fst_verify);
int fstinfo_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
string usage = "Prints out information about an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 2) {
ShowUsage();
return 1;
}
const string in_name =
(argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
s::PrintFstInfo(*ifst, FLAGS_test_properties, FLAGS_arc_filter,
FLAGS_info_type, FLAGS_fst_verify, FLAGS_pipe);
return 0;
}
@@ -0,0 +1,20 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_string(arc_filter, "any",
"Arc filter: one of:"
" \"any\", \"epsilon\", \"iepsilon\", \"oepsilon\"; "
"this only affects the counts of (co)accessible states, "
"connected states, and (strongly) connected components");
DEFINE_string(info_type, "auto",
"Info format: one of: \"auto\", \"long\", \"short\"");
DEFINE_bool(pipe, false, "Send info to stderr, input to stdout");
DEFINE_bool(test_properties, true,
"Compute property values (if unknown to FST)");
DEFINE_bool(fst_verify, true, "Verify FST sanity");
int fstinfo_main(int argc, char **argv);
int main(int argc, char **argv) { return fstinfo_main(argc, argv); }
@@ -0,0 +1,65 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Intersects two FSTs.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/getters.h>
#include <fst/script/intersect.h>
DECLARE_string(compose_filter);
DECLARE_bool(connect);
int fstintersect_main(int argc, char **argv) {
namespace s = fst::script;
using fst::ComposeFilter;
using fst::script::FstClass;
using fst::script::VectorFstClass;
string usage = "Intersects two FSAs.\n\n Usage: ";
usage += argv[0];
usage += " in1.fst in2.fst [out.fst]\n";
usage += " Flags: connect\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc < 3 || argc > 4) {
ShowUsage();
return 1;
}
const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1];
const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2];
const string out_name = argc > 3 ? argv[3] : "";
if (in1_name.empty() && in2_name.empty()) {
LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input";
return 1;
}
std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
if (!ifst1) return 1;
std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
if (!ifst2) return 1;
VectorFstClass ofst(ifst1->ArcType());
ComposeFilter compose_filter;
if (!s::GetComposeFilter(FLAGS_compose_filter, &compose_filter)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported compose filter type: "
<< FLAGS_compose_filter;
return 1;
}
const fst::IntersectOptions opts(FLAGS_connect, compose_filter);
s::Intersect(*ifst1, *ifst2, &ofst, opts);
return !ofst.Write(out_name);
}
@@ -0,0 +1,13 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_string(compose_filter, "auto",
"Composition filter, one of: \"alt_sequence\", \"auto\", "
"\"match\", \"null\", \"sequence\", \"trivial\"");
DEFINE_bool(connect, true, "Trim output");
int fstintersect_main(int argc, char **argv);
int main(int argc, char **argv) { return fstintersect_main(argc, argv); }
@@ -0,0 +1,38 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Inverts a transduction.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/invert.h>
int fstinvert_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
string usage = "Inverts a transduction.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
s::Invert(fst.get());
return !fst->Write(out_name);
}
@@ -0,0 +1,6 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
int fstinvert_main(int argc, char **argv);
int main(int argc, char **argv) { return fstinvert_main(argc, argv); }
@@ -0,0 +1,53 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Two FSTS are isomorphic (equal up to state and arc re-ordering) iff their
// exit status is zero. FSTs should be deterministic when viewed as unweighted
// automata.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/isomorphic.h>
DECLARE_double(delta);
int fstisomorphic_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
string usage =
"Two FSTs are isomorphic iff the exit status is zero.\n\n Usage: ";
usage += argv[0];
usage += " in1.fst in2.fst\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc != 3) {
ShowUsage();
return 1;
}
const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1];
const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2];
if (in1_name.empty() && in2_name.empty()) {
LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input";
return 1;
}
std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
if (!ifst1) return 1;
std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
if (!ifst2) return 1;
bool result = s::Isomorphic(*ifst1, *ifst2, FLAGS_delta);
if (!result) VLOG(1) << "FSTs are not isomorphic";
return result ? 0 : 2;
}
@@ -0,0 +1,11 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta");
int fstisomorphic_main(int argc, char **argv);
int main(int argc, char **argv) { return fstisomorphic_main(argc, argv); }
@@ -0,0 +1,60 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Applies an operation to each arc of an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/getters.h>
#include <fst/script/map.h>
DECLARE_double(delta);
DECLARE_string(map_type);
DECLARE_double(power);
DECLARE_string(weight);
int fstmap_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::WeightClass;
string usage = "Applies an operation to each arc of an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
s::MapType map_type;
if (!s::GetMapType(FLAGS_map_type, &map_type)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported map type "
<< FLAGS_map_type;
return 1;
}
const auto weight_param =
!FLAGS_weight.empty()
? WeightClass(ifst->WeightType(), FLAGS_weight)
: (FLAGS_map_type == "times" ? WeightClass::One(ifst->WeightType())
: WeightClass::Zero(ifst->WeightType()));
std::unique_ptr<FstClass> ofst(
s::Map(*ifst, map_type, FLAGS_delta, FLAGS_power, weight_param));
return !ofst->Write(out_name);
}
@@ -0,0 +1,20 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta");
DEFINE_string(map_type, "identity",
"Map operation, one of: \"arc_sum\", \"arc_unique\", "
"\"float_power\" (--power)\", \"identity\", \"input_epsilon\", "
"\"invert\", \"output_epsilon\", \"plus (--weight)\", "
"\"quantize (--delta)\", \"rmweight\", \"superfinal\", "
"\"power (--power)\", \"times (--weight)\", \"to_log\", "
"\"to_log64\", \"to_std\"");
DEFINE_double(power, 1.0, "Power parameter");
DEFINE_string(weight, "", "Weight parameter");
int fstmap_main(int argc, char **argv);
int main(int argc, char **argv) { return fstmap_main(argc, argv); }
@@ -0,0 +1,57 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Minimizes a deterministic FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/minimize.h>
DECLARE_double(delta);
DECLARE_bool(allow_nondet);
int fstminimize_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
using fst::script::VectorFstClass;
string usage = "Minimizes a deterministic FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out1.fst [out2.fst]]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 4) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out1_name =
(argc > 2 && strcmp(argv[2], "-") != 0) ? argv[2] : "";
const string out2_name =
(argc > 3 && strcmp(argv[3], "-") != 0) ? argv[3] : "";
if (out1_name.empty() && out2_name.empty() && argc > 3) {
LOG(ERROR) << argv[0] << ": Both outputs can't be standard output.";
return 1;
}
std::unique_ptr<MutableFstClass> fst1(MutableFstClass::Read(in_name, true));
if (!fst1) return 1;
if (argc > 3) {
std::unique_ptr<MutableFstClass> fst2(new VectorFstClass(fst1->ArcType()));
s::Minimize(fst1.get(), fst2.get(), FLAGS_delta, FLAGS_allow_nondet);
if (!fst2->Write(out2_name)) return 1;
} else {
s::Minimize(fst1.get(), nullptr, FLAGS_delta, FLAGS_allow_nondet);
}
return !fst1->Write(out1_name);
}
@@ -0,0 +1,13 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/shortest-distance.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kShortestDelta, "Comparison/quantization delta");
DEFINE_bool(allow_nondet, false, "Minimize non-deterministic FSTs");
int fstminimize_main(int argc, char **argv);
int main(int argc, char **argv) { return fstminimize_main(argc, argv); }
@@ -0,0 +1,104 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Prints out binary FSTs in simple text format used by AT&T.
#include <cstring>
#include <fstream>
#include <memory>
#include <ostream>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/print.h>
DECLARE_bool(acceptor);
DECLARE_string(isymbols);
DECLARE_string(osymbols);
DECLARE_string(ssymbols);
DECLARE_bool(numeric);
DECLARE_string(save_isymbols);
DECLARE_string(save_osymbols);
DECLARE_bool(show_weight_one);
DECLARE_bool(allow_negative_labels);
DECLARE_string(missing_symbol);
int fstprint_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::SymbolTable;
using fst::SymbolTableTextOptions;
string usage = "Prints out binary FSTs in simple text format.\n\n Usage: ";
usage += argv[0];
usage += " [binary.fst [text.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> fst(FstClass::Read(in_name));
if (!fst) return 1;
string dest = "standard output";
std::ofstream fstrm;
if (argc == 3) {
fstrm.open(argv[2]);
if (!fstrm) {
LOG(ERROR) << argv[0] << ": Open failed, file = " << argv[2];
return 1;
}
dest = argv[2];
}
std::ostream &ostrm = fstrm.is_open() ? fstrm : std::cout;
ostrm.precision(9);
const SymbolTableTextOptions opts(FLAGS_allow_negative_labels);
std::unique_ptr<const SymbolTable> isyms;
if (!FLAGS_isymbols.empty() && !FLAGS_numeric) {
isyms.reset(SymbolTable::ReadText(FLAGS_isymbols, opts));
if (!isyms) return 1;
}
std::unique_ptr<const SymbolTable> osyms;
if (!FLAGS_osymbols.empty() && !FLAGS_numeric) {
osyms.reset(SymbolTable::ReadText(FLAGS_osymbols, opts));
if (!osyms) return 1;
}
std::unique_ptr<const SymbolTable> ssyms;
if (!FLAGS_ssymbols.empty() && !FLAGS_numeric) {
ssyms.reset(SymbolTable::ReadText(FLAGS_ssymbols));
if (!ssyms) return 1;
}
if (!isyms && !FLAGS_numeric && fst->InputSymbols()) {
isyms.reset(fst->InputSymbols()->Copy());
}
if (!osyms && !FLAGS_numeric && fst->OutputSymbols()) {
osyms.reset(fst->OutputSymbols()->Copy());
}
s::PrintFst(*fst, ostrm, dest, isyms.get(), osyms.get(), ssyms.get(),
FLAGS_acceptor, FLAGS_show_weight_one, FLAGS_missing_symbol);
if (isyms && !FLAGS_save_isymbols.empty()) {
if (!isyms->WriteText(FLAGS_save_isymbols)) return 1;
}
if (osyms && !FLAGS_save_osymbols.empty()) {
if (!osyms->WriteText(FLAGS_save_osymbols)) return 1;
}
return 0;
}
@@ -0,0 +1,22 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(acceptor, false, "Input in acceptor format?");
DEFINE_string(isymbols, "", "Input label symbol table");
DEFINE_string(osymbols, "", "Output label symbol table");
DEFINE_string(ssymbols, "", "State label symbol table");
DEFINE_bool(numeric, false, "Print numeric labels?");
DEFINE_string(save_isymbols, "", "Save input symbol table to file");
DEFINE_string(save_osymbols, "", "Save output symbol table to file");
DEFINE_bool(show_weight_one, false,
"Print/draw arc weights and final weights equal to semiring One?");
DEFINE_bool(allow_negative_labels, false,
"Allow negative labels (not recommended; may cause conflicts)?");
DEFINE_string(missing_symbol, "",
"Symbol to print when lookup fails (default raises error)");
int fstprint_main(int argc, char **argv);
int main(int argc, char **argv) { return fstprint_main(argc, argv); }
@@ -0,0 +1,43 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Projects a transduction onto its input or output language.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/getters.h>
#include <fst/script/project.h>
DECLARE_bool(project_output);
int fstproject_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
string usage =
"Projects a transduction onto its input"
" or output language.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
s::Project(fst.get(), s::GetProjectType(FLAGS_project_output));
return !fst->Write(out_name);
}
@@ -0,0 +1,10 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(project_output, false, "Project on output (vs. input)");
int fstproject_main(int argc, char **argv);
int main(int argc, char **argv) { return fstproject_main(argc, argv); }
@@ -0,0 +1,47 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Prunes states and arcs of an FST w.r.t. the shortest path weight.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/prune.h>
DECLARE_double(delta);
DECLARE_int64(nstate);
DECLARE_string(weight);
int fstprune_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
using fst::script::WeightClass;
string usage = "Prunes states and arcs of an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
const auto weight_threshold =
FLAGS_weight.empty() ? WeightClass::Zero(fst->WeightType())
: WeightClass(fst->WeightType(), FLAGS_weight);
s::Prune(fst.get(), weight_threshold, FLAGS_nstate, FLAGS_delta);
return !fst->Write(out_name);
}
@@ -0,0 +1,14 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/fst.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta");
DEFINE_int64(nstate, fst::kNoStateId, "State number threshold");
DEFINE_string(weight, "", "Weight threshold");
int fstprune_main(int argc, char **argv);
int main(int argc, char **argv) { return fstprune_main(argc, argv); }
@@ -0,0 +1,55 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Pushes weights and/or output labels in an FST toward the initial or final
// states.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/getters.h>
#include <fst/script/push.h>
DECLARE_double(delta);
DECLARE_bool(push_weights);
DECLARE_bool(push_labels);
DECLARE_bool(remove_total_weight);
DECLARE_bool(remove_common_affix);
DECLARE_bool(to_final);
int fstpush_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::VectorFstClass;
string usage = "Pushes weights and/or olabels in an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
const auto flags =
s::GetPushFlags(FLAGS_push_weights, FLAGS_push_labels,
FLAGS_remove_total_weight, FLAGS_remove_common_affix);
VectorFstClass ofst(ifst->ArcType());
s::Push(*ifst, &ofst, flags, s::GetReweightType(FLAGS_to_final),
FLAGS_delta);
return !ofst.Write(out_name);
}
@@ -0,0 +1,18 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kDelta, "Comparison/quantization delta");
DEFINE_bool(push_weights, false, "Push weights");
DEFINE_bool(push_labels, false, "Push output labels");
DEFINE_bool(remove_total_weight, false,
"Remove total weight when pushing weights");
DEFINE_bool(remove_common_affix, false,
"Remove common prefix/suffix when pushing labels");
DEFINE_bool(to_final, false, "Push/reweight to final (vs. to initial) states");
int fstpush_main(int argc, char **argv);
int main(int argc, char **argv) { return fstpush_main(argc, argv); }
@@ -0,0 +1,62 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Generates random paths through an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/getters.h>
#include <fst/script/randgen.h>
DECLARE_int32(max_length);
DECLARE_int32(npath);
DECLARE_int32(seed);
DECLARE_string(select);
DECLARE_bool(weighted);
DECLARE_bool(remove_total_weight);
int fstrandgen_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::VectorFstClass;
string usage = "Generates random paths through an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
VLOG(1) << argv[0] << ": Seed = " << FLAGS_seed;
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
VectorFstClass ofst(ifst->ArcType());
s::RandArcSelection ras;
if (!s::GetRandArcSelection(FLAGS_select, &ras)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported select type "
<< FLAGS_select;
return 1;
}
s::RandGen(*ifst, &ofst, FLAGS_seed,
fst::RandGenOptions<s::RandArcSelection>(
ras, FLAGS_max_length, FLAGS_npath, FLAGS_weighted,
FLAGS_remove_total_weight));
return !ofst.Write(out_name);
}
@@ -0,0 +1,27 @@
#ifndef _MSC_VER
#include <unistd.h>
#else
#include <process.h>
#define getpid _getpid
#endif
#include <climits>
#include <ctime>
#include <fst/flags.h>
DEFINE_int32(max_length, INT32_MAX, "Maximum path length");
DEFINE_int32(npath, 1, "Number of paths to generate");
DEFINE_int32(seed, time(nullptr) + getpid(), "Random seed");
DEFINE_string(select, "uniform",
"Selection type: one of: "
" \"uniform\", \"log_prob\" (when appropriate),"
" \"fast_log_prob\" (when appropriate)");
DEFINE_bool(weighted, false,
"Output tree weighted by path count vs. unweighted paths");
DEFINE_bool(remove_total_weight, false,
"Remove total weight when output weighted");
int fstrandgen_main(int argc, char **argv);
int main(int argc, char **argv) { return fstrandgen_main(argc, argv); }
@@ -0,0 +1,104 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Relabels input or output space of an FST.
#include <cstring>
#include <memory>
#include <string>
#include <vector>
#include <fst/flags.h>
#include <fst/util.h>
#include <fst/script/relabel.h>
#include <fst/script/weight-class.h>
DECLARE_string(isymbols);
DECLARE_string(osymbols);
DECLARE_string(relabel_isymbols);
DECLARE_string(relabel_osymbols);
DECLARE_string(relabel_ipairs);
DECLARE_string(relabel_opairs);
DECLARE_string(unknown_isymbol);
DECLARE_string(unknown_osymbol);
DECLARE_bool(allow_negative_labels);
int fstrelabel_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
using fst::SymbolTable;
using fst::SymbolTableTextOptions;
string usage =
"Relabels the input and/or the output labels of the FST.\n\n"
" Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
usage += "\n Using SymbolTables flags:\n";
usage += " --relabel_isymbols isyms.map\n";
usage += " --relabel_osymbols osyms.map\n";
usage += "\n Using numeric labels flags:\n";
usage += " --relabel_ipairs ipairs.txt\n";
usage += " --relabel_opairs opairs.txt\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name =
(argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
// Relabel with symbol tables.
const SymbolTableTextOptions opts(FLAGS_allow_negative_labels);
if (!FLAGS_relabel_isymbols.empty() || !FLAGS_relabel_osymbols.empty()) {
bool attach_new_isymbols = (fst->InputSymbols() != nullptr);
std::unique_ptr<const SymbolTable> old_isymbols(
FLAGS_isymbols.empty() ? nullptr
: SymbolTable::ReadText(FLAGS_isymbols, opts));
const std::unique_ptr<const SymbolTable> relabel_isymbols(
FLAGS_relabel_isymbols.empty()
? nullptr
: SymbolTable::ReadText(FLAGS_relabel_isymbols, opts));
bool attach_new_osymbols = (fst->OutputSymbols() != nullptr);
std::unique_ptr<const SymbolTable> old_osymbols(
FLAGS_osymbols.empty() ? nullptr
: SymbolTable::ReadText(FLAGS_osymbols, opts));
const std::unique_ptr<const SymbolTable> relabel_osymbols(
FLAGS_relabel_osymbols.empty()
? nullptr
: SymbolTable::ReadText(FLAGS_relabel_osymbols, opts));
s::Relabel(fst.get(),
old_isymbols ? old_isymbols.get() : fst->InputSymbols(),
relabel_isymbols.get(), FLAGS_unknown_isymbol,
attach_new_isymbols,
old_osymbols ? old_osymbols.get() : fst->OutputSymbols(),
relabel_osymbols.get(), FLAGS_unknown_osymbol,
attach_new_osymbols);
} else {
// Reads in relabeling pairs.
std::vector<s::LabelPair> ipairs;
std::vector<s::LabelPair> opairs;
if (!FLAGS_relabel_ipairs.empty()) {
if (!fst::ReadLabelPairs(FLAGS_relabel_ipairs, &ipairs,
FLAGS_allow_negative_labels))
return 1;
}
if (!FLAGS_relabel_opairs.empty()) {
if (!fst::ReadLabelPairs(FLAGS_relabel_opairs, &opairs,
FLAGS_allow_negative_labels))
return 1;
}
s::Relabel(fst.get(), ipairs, opairs);
}
return !fst->Write(out_name);
}
@@ -0,0 +1,21 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_string(isymbols, "", "Input label symbol table");
DEFINE_string(osymbols, "", "Output label symbol table");
DEFINE_string(relabel_isymbols, "", "Input symbol set to relabel to");
DEFINE_string(relabel_osymbols, "", "Output symbol set to relabel to");
DEFINE_string(relabel_ipairs, "", "Input relabel pairs (numeric)");
DEFINE_string(relabel_opairs, "", "Output relabel pairs (numeric)");
DEFINE_string(unknown_isymbol, "",
"Input symbol to use to relabel OOVs (default: OOVs are errors)");
DEFINE_string(unknown_osymbol, "",
"Output symbol to use to relabel OOVs (default: OOVs are errors)");
DEFINE_bool(allow_negative_labels, false,
"Allow negative labels (not recommended; may cause conflicts)");
int fstrelabel_main(int argc, char **argv);
int main(int argc, char **argv) { return fstrelabel_main(argc, argv); }
@@ -0,0 +1,91 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Performs the dynamic replacement of arcs in one FST with another FST,
// allowing for the definition of FSTs analogous to RTNs.
#include <cstring>
#include <string>
#include <vector>
#include <fst/flags.h>
#include <fst/script/getters.h>
#include <fst/script/replace.h>
DECLARE_string(call_arc_labeling);
DECLARE_string(return_arc_labeling);
DECLARE_int64(return_label);
DECLARE_bool(epsilon_on_replace);
void Cleanup(std::vector<fst::script::LabelFstClassPair> *pairs) {
for (const auto &pair : *pairs) {
delete pair.second;
}
pairs->clear();
}
int fstreplace_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::VectorFstClass;
using fst::ReplaceLabelType;
string usage = "Recursively replaces FST arcs with other FST(s).\n\n"
" Usage: ";
usage += argv[0];
usage += " root.fst rootlabel [rule1.fst label1 ...] [out.fst]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc < 4) {
ShowUsage();
return 1;
}
const string in_name = argv[1];
const string out_name = argc % 2 == 0 ? argv[argc - 1] : "";
auto *ifst = FstClass::Read(in_name);
if (!ifst) return 1;
std::vector<s::LabelFstClassPair> pairs;
// Note that if the root label is beyond the range of the underlying FST's
// labels, truncation will occur.
const auto root = atoll(argv[2]);
pairs.emplace_back(root, ifst);
for (auto i = 3; i < argc - 1; i += 2) {
ifst = FstClass::Read(argv[i]);
if (!ifst) {
Cleanup(&pairs);
return 1;
}
// Note that if the root label is beyond the range of the underlying FST's
// labels, truncation will occur.
const auto label = atoll(argv[i + 1]);
pairs.emplace_back(label, ifst);
}
ReplaceLabelType call_label_type;
if (!s::GetReplaceLabelType(FLAGS_call_arc_labeling, FLAGS_epsilon_on_replace,
&call_label_type)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported call arc replace "
<< "label type: " << FLAGS_call_arc_labeling;
}
ReplaceLabelType return_label_type;
if (!s::GetReplaceLabelType(FLAGS_return_arc_labeling,
FLAGS_epsilon_on_replace, &return_label_type)) {
LOG(ERROR) << argv[0] << ": Unknown or unsupported return arc replace "
<< "label type: " << FLAGS_return_arc_labeling;
}
s::ReplaceOptions opts(root, call_label_type, return_label_type,
FLAGS_return_label);
VectorFstClass ofst(ifst->ArcType());
s::Replace(pairs, &ofst, opts);
Cleanup(&pairs);
return !ofst.Write(out_name);
}
@@ -0,0 +1,17 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_string(call_arc_labeling, "input",
"Which labels to make non-epsilon on the call arc. "
"One of: \"input\" (default), \"output\", \"both\", \"neither\"");
DEFINE_string(return_arc_labeling, "neither",
"Which labels to make non-epsilon on the return arc. "
"One of: \"input\", \"output\", \"both\", \"neither\" (default)");
DEFINE_int64(return_label, 0, "Label to put on return arc");
DEFINE_bool(epsilon_on_replace, false, "Call/return arcs are epsilon arcs?");
int fstreplace_main(int argc, char **argv);
int main(int argc, char **argv) { return fstreplace_main(argc, argv); }
@@ -0,0 +1,45 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Reverses the paths in an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/fst-class.h>
#include <fst/script/reverse.h>
DECLARE_bool(require_superinitial);
int fstreverse_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::VectorFstClass;
string usage = "Reverses the paths in an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name =
(argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
VectorFstClass ofst(ifst->ArcType());
s::Reverse(*ifst, &ofst, FLAGS_require_superinitial);
return !ofst.Write(out_name);
}
@@ -0,0 +1,10 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(require_superinitial, true, "Always create a superinitial state");
int fstreverse_main(int argc, char **argv);
int main(int argc, char **argv) { return fstreverse_main(argc, argv); }
@@ -0,0 +1,50 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Reweights an FST.
#include <cstring>
#include <memory>
#include <string>
#include <vector>
#include <fst/flags.h>
#include <fst/script/getters.h>
#include <fst/script/reweight.h>
#include <fst/script/text-io.h>
DECLARE_bool(to_final);
int fstreweight_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
using fst::script::WeightClass;
string usage = "Reweights an FST.\n\n Usage: ";
usage += argv[0];
usage += " in.fst potential.txt [out.fst]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc < 3 || argc > 4) {
ShowUsage();
return 1;
}
const string in_name = argv[1];
const string potentials_name = argv[2];
const string out_name = argc > 3 ? argv[3] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
std::vector<WeightClass> potential;
if (!s::ReadPotentials(fst->WeightType(), potentials_name, &potential)) {
return 1;
}
s::Reweight(fst.get(), potential, s::GetReweightType(FLAGS_to_final));
return !fst->Write(out_name);
}
@@ -0,0 +1,10 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_bool(to_final, false, "Push/reweight to final (vs. to initial) states");
int fstreweight_main(int argc, char **argv);
int main(int argc, char **argv) { return fstreweight_main(argc, argv); }
@@ -0,0 +1,61 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Removes epsilons from an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/getters.h>
#include <fst/script/rmepsilon.h>
DECLARE_bool(connect);
DECLARE_double(delta);
DECLARE_int64(nstate);
DECLARE_string(queue_type);
DECLARE_string(weight);
int fstrmepsilon_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
using fst::script::WeightClass;
string usage = "Removes epsilons from an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
const auto weight_threshold =
FLAGS_weight.empty() ? WeightClass::Zero(fst->WeightType())
: WeightClass(fst->WeightType(), FLAGS_weight);
fst::QueueType queue_type;
if (!s::GetQueueType(FLAGS_queue_type, &queue_type)) {
LOG(ERROR) << argv[0]
<< ": Unknown or unsupported queue type: " << FLAGS_queue_type;
return 1;
}
const s::RmEpsilonOptions opts(queue_type, FLAGS_connect, weight_threshold,
FLAGS_nstate, FLAGS_delta);
s::RmEpsilon(fst.get(), opts);
return !fst->Write(out_name);
}
@@ -0,0 +1,19 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/fst.h>
#include <fst/shortest-distance.h>
#include <fst/weight.h>
DEFINE_bool(connect, true, "Trim output");
DEFINE_double(delta, fst::kShortestDelta, "Comparison/quantization delta");
DEFINE_int64(nstate, fst::kNoStateId, "State number threshold");
DEFINE_string(queue_type, "auto",
"Queue type: one of: \"auto\", "
"\"fifo\", \"lifo\", \"shortest\", \"state\", \"top\"");
DEFINE_string(weight, "", "Weight threshold");
int fstrmepsilon_main(int argc, char **argv);
int main(int argc, char **argv) { return fstrmepsilon_main(argc, argv); }
@@ -0,0 +1,70 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Find shortest distances in an FST.
#include <cstring>
#include <memory>
#include <string>
#include <vector>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/getters.h>
#include <fst/script/shortest-distance.h>
#include <fst/script/text-io.h>
DECLARE_bool(reverse);
DECLARE_double(delta);
DECLARE_int64(nstate);
DECLARE_string(queue_type);
int fstshortestdistance_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::WeightClass;
using fst::QueueType;
using fst::AUTO_QUEUE;
string usage = "Finds shortest distance(s) in an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [distance.txt]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
string in_name = (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : "";
string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
std::vector<WeightClass> distance;
QueueType queue_type;
if (!s::GetQueueType(FLAGS_queue_type, &queue_type)) {
LOG(ERROR) << argv[0]
<< ": Unknown or unsupported queue type: " << FLAGS_queue_type;
return 1;
}
if (FLAGS_reverse && queue_type != AUTO_QUEUE) {
LOG(ERROR) << argv[0] << ": Can't use non-default queue with reverse";
return 1;
}
if (FLAGS_reverse) {
s::ShortestDistance(*ifst, &distance, FLAGS_reverse, FLAGS_delta);
} else {
const s::ShortestDistanceOptions opts(queue_type, s::ANY_ARC_FILTER,
FLAGS_nstate, FLAGS_delta);
s::ShortestDistance(*ifst, &distance, opts);
}
return !s::WritePotentials(out_name, distance);
}
@@ -0,0 +1,18 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/fst.h>
#include <fst/shortest-distance.h>
#include <fst/weight.h>
DEFINE_bool(reverse, false, "Perform in the reverse direction");
DEFINE_double(delta, fst::kShortestDelta, "Comparison/quantization delta");
DEFINE_int64(nstate, fst::kNoStateId, "State number threshold");
DEFINE_string(queue_type, "auto",
"Queue type: one of: \"auto\", "
"\"fifo\", \"lifo\", \"shortest\", \"state\", \"top\"");
int fstshortestdistance_main(int argc, char **argv);
int main(int argc, char **argv) { return fstshortestdistance_main(argc, argv); }
@@ -0,0 +1,67 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Find shortest path(s) in an FST.
#include <cstring>
#include <memory>
#include <string>
#include <vector>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/getters.h>
#include <fst/script/shortest-path.h>
DECLARE_double(delta);
DECLARE_int32(nshortest);
DECLARE_int64(nstate);
DECLARE_string(queue_type);
DECLARE_bool(unique);
DECLARE_string(weight);
int fstshortestpath_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::WeightClass;
using fst::script::VectorFstClass;
string usage = "Finds shortest path(s) in an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name =
(argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
const auto weight_threshold =
FLAGS_weight.empty() ? WeightClass::Zero(ifst->WeightType())
: WeightClass(ifst->WeightType(), FLAGS_weight);
VectorFstClass ofst(ifst->ArcType());
fst::QueueType queue_type;
if (!s::GetQueueType(FLAGS_queue_type, &queue_type)) {
LOG(ERROR) << "Unknown or unsupported queue type: " << FLAGS_queue_type;
return 1;
}
const s::ShortestPathOptions opts(queue_type, FLAGS_nshortest,
FLAGS_unique, FLAGS_delta,
weight_threshold, FLAGS_nstate);
s::ShortestPath(*ifst, &ofst, opts);
return !ofst.Write(out_name);
}
@@ -0,0 +1,20 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
#include <fst/fst.h>
#include <fst/shortest-distance.h>
#include <fst/weight.h>
DEFINE_double(delta, fst::kShortestDelta, "Comparison/quantization delta");
DEFINE_int32(nshortest, 1, "Return N-shortest paths");
DEFINE_int64(nstate, fst::kNoStateId, "State number threshold");
DEFINE_string(queue_type, "auto",
"Queue type: one of \"auto\", "
"\"fifo\", \"lifo\", \"shortest\', \"state\", \"top\"");
DEFINE_bool(unique, false, "Return unique strings");
DEFINE_string(weight, "", "Weight threshold");
int fstshortestpath_main(int argc, char **argv);
int main(int argc, char **argv) { return fstshortestpath_main(argc, argv); }
@@ -0,0 +1,111 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Performs operations (set, clear, relabel) on the symbols table attached to an
// input FST.
#include <cstring>
#include <memory>
#include <string>
#include <vector>
#include <fst/flags.h>
#include <fst/util.h>
#include <fst/script/fst-class.h>
#include <fst/script/verify.h>
DECLARE_string(isymbols);
DECLARE_string(osymbols);
DECLARE_bool(clear_isymbols);
DECLARE_bool(clear_osymbols);
DECLARE_string(relabel_ipairs);
DECLARE_string(relabel_opairs);
DECLARE_string(save_isymbols);
DECLARE_string(save_osymbols);
DECLARE_bool(allow_negative_labels);
DECLARE_bool(verify);
int fstsymbols_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
using fst::ReadLabelPairs;
using fst::SymbolTable;
using fst::SymbolTableTextOptions;
string usage =
"Performs operations (set, clear, relabel) on the symbol"
" tables attached to an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = argc > 1 && strcmp(argv[1], "-") != 0 ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
if (!FLAGS_save_isymbols.empty()) {
const auto *isyms = fst->InputSymbols();
if (isyms) {
isyms->WriteText(FLAGS_save_isymbols);
} else {
LOG(ERROR) << argv[0]
<< ": Saving isymbols but there are no input symbols.";
}
}
if (!FLAGS_save_osymbols.empty()) {
const auto *osyms = fst->OutputSymbols();
if (osyms) {
osyms->WriteText(FLAGS_save_osymbols);
} else {
LOG(ERROR) << argv[0]
<< ": Saving osymbols but there are no output symbols.";
}
}
const SymbolTableTextOptions opts(FLAGS_allow_negative_labels);
std::unique_ptr<SymbolTable> isyms;
if (!FLAGS_isymbols.empty()) {
isyms.reset(SymbolTable::ReadText(FLAGS_isymbols, opts));
fst->SetInputSymbols(isyms.get());
} else if (FLAGS_clear_isymbols) {
fst->SetInputSymbols(nullptr);
}
std::unique_ptr<SymbolTable> osyms;
if (!FLAGS_osymbols.empty()) {
osyms.reset(SymbolTable::ReadText(FLAGS_osymbols, opts));
fst->SetOutputSymbols(osyms.get());
} else if (FLAGS_clear_osymbols) {
fst->SetOutputSymbols(nullptr);
}
using Label = int64;
if (!FLAGS_relabel_ipairs.empty()) {
std::vector<std::pair<Label, Label>> ipairs;
ReadLabelPairs(FLAGS_relabel_ipairs, &ipairs, FLAGS_allow_negative_labels);
std::unique_ptr<SymbolTable> isyms_relabel(
RelabelSymbolTable(fst->InputSymbols(), ipairs));
fst->SetInputSymbols(isyms_relabel.get());
}
if (!FLAGS_relabel_opairs.empty()) {
std::vector<std::pair<Label, Label>> opairs;
ReadLabelPairs(FLAGS_relabel_opairs, &opairs, FLAGS_allow_negative_labels);
std::unique_ptr<SymbolTable> osyms_relabel(
RelabelSymbolTable(fst->OutputSymbols(), opairs));
fst->SetOutputSymbols(osyms_relabel.get());
}
if (FLAGS_verify && !s::Verify(*fst)) return 1;
return !fst->Write(out_name);
}
@@ -0,0 +1,20 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
#include <fst/flags.h>
DEFINE_string(isymbols, "", "Input label symbol table");
DEFINE_string(osymbols, "", "Output label symbol table");
DEFINE_bool(clear_isymbols, false, "Clear input symbol table");
DEFINE_bool(clear_osymbols, false, "Clear output symbol table");
DEFINE_string(relabel_ipairs, "", "Input relabel pairs (numeric)");
DEFINE_string(relabel_opairs, "", "Output relabel pairs (numeric)");
DEFINE_string(save_isymbols, "", "Save fst file's input symbol table to file");
DEFINE_string(save_osymbols, "", "Save fst file's output symbol table to file");
DEFINE_bool(allow_negative_labels, false,
"Allow negative labels (not recommended; may cause conflicts)");
DEFINE_bool(verify, false, "Verify fst properities before saving");
int fstsymbols_main(int argc, char **argv);
int main(int argc, char **argv) { return fstsymbols_main(argc, argv); }
@@ -0,0 +1,41 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Synchronizes an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/script/synchronize.h>
int fstsynchronize_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
using fst::script::VectorFstClass;
string usage = "Synchronizes an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = (argc > 1 && strcmp(argv[1], "-") != 0) ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<FstClass> ifst(FstClass::Read(in_name));
if (!ifst) return 1;
VectorFstClass ofst(ifst->ArcType());
s::Synchronize(*ifst, &ofst);
return !ofst.Write(out_name);
}
@@ -0,0 +1,6 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
int fstsynchronize_main(int argc, char **argv);
int main(int argc, char **argv) { return fstsynchronize_main(argc, argv); }
@@ -0,0 +1,41 @@
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Topologically sorts an FST.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/topsort.h>
int fsttopsort_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::MutableFstClass;
string usage = "Topologically sorts an FST.\n\n Usage: ";
usage += argv[0];
usage += " [in.fst [out.fst]]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
const string in_name = argc > 1 && strcmp(argv[1], "-") != 0 ? argv[1] : "";
const string out_name = argc > 2 ? argv[2] : "";
std::unique_ptr<MutableFstClass> fst(MutableFstClass::Read(in_name, true));
if (!fst) return 1;
bool acyclic = TopSort(fst.get());
if (!acyclic) LOG(WARNING) << argv[0] << ": Input FST is cyclic";
return !fst->Write(out_name);
}

Some files were not shown because too many files have changed in this diff Show More