Commit 78533996 authored by Giulio Paci's avatar Giulio Paci

Imported Upstream version 1.2.1

parent 21555b2a
......@@ -10,7 +10,7 @@ OpenFst - Release 1.2
* Added PowerWeight and Power Arc.
* Added fstsymbols shell-level command
* Added total weight removal option to pushing
* Changed methods for symbol table mutation
* Changed methods for symbol table mutation: use MutableInputSymbols()/MutableOutputSymbols().
* Numerous efficiency improvements esp in composition, replace, and caching
* Fixed numerous bugs including:
- improper types of some approximation deltas
......@@ -21,6 +21,7 @@ OpenFst - Release 1.2
- symbol table checksumming issues
- various C++ standards issues
- Visit() behavior when visitation aborted
- Decode() hash performance bug
* Added extensions directories including:
- finite-state archive (FAR) utilities
- compact fsts
......
......@@ -5,23 +5,29 @@ searching weighted finite-state transducers (FSTs).
REQUIREMENTS:
This version is known to work under Linux, MacOS, and Solaris using
g++ (>= 4.1). Expected to work wherever adequate POSIX (dlopen, ssize_t),
g++ (>= 4.1). Expected to work wherever adequate POSIX (dlopen, ssize_t, basename),
c99 (snprintf, strtoll, long long), and tr1 (<tr1/ordered_set>,
<tr1/ordered_map>) support are available.
INSTALLATION:
Follow the generic GNU build system instructions in ./INSTALL.
Follow the generic GNU build system instructions in ./INSTALL. We
recommend configuring with =--enable-static=false= for faster
compiles.
Optional features:
--enable-compact-fsts Enable all CompactFst classes as shared objects
--enable-const-fsts Enable all ConstFst classes as shared objects
--enable-far Enable FAR (FST Archive) extension
--enable-lookahead-fsts Enable LookAheadFST classes as shared objects
--enable-pdt Experimental push-down transducer extensions
--with-icu Use ICU to provide unicode support
--enable-bin Build fst::script and command-line binaries (def: yes)
--enable-compact-fsts Enable all CompactFst classes (def: no)
--enable-const-fsts Enable all ConstFst classes (def: no)
--enable-far Enable FAR (FST Archive) extension (def: no)
--enable-lookahead-fsts Enable LookAheadFst classes (def: no)
--enable-pdt Experimental push-down transducer extensions (def: no)
--with-icu Use ICU to provide unicode support (def: no)
(Compiling with '-Wall -Wno-sign-compare' under g++ should give no
warnings from this library).
Configuring with --enable-bin=no gives very fast compiles, but
excludes the command line utilities.
Compiling with '-Wall -Wno-sign-compare' under g++ should give no
warnings from this library.
USAGE:
Assuming you've installed under the default /usr/local, the FST
......
This diff is collapsed.
AC_INIT([OpenFst], [1.2], [help@www.openfst.org])
AC_INIT([OpenFst], [1.2.1], [help@www.openfst.org])
AM_INIT_AUTOMAKE([foreign nostdinc -Wall -Werror])
AC_PROG_CXX
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_CONFIG_HEADERS([config.h src/include/fst/config.h])
......@@ -29,6 +30,16 @@ AC_CHECK_TYPES([std::tr1::hash<long long unsigned>], [], [],
AC_CHECK_TYPES([__gnu_cxx::slist<int>], [], [],
[[#include <ext/slist>]])
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])
AC_ARG_ENABLE(
[compact-fsts],
[AS_HELP_STRING(
......
AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../script $(ICU_FLAGS)
AM_LDFLAGS = -lm -ldl
if HAVE_BIN
bin_PROGRAMS = fstarcsort fstclosure fstcompile fstcompose fstconcat \
fstconnect fstconvert fstdeterminize fstdifference fstdraw fstencode \
fstepsnormalize fstequal fstequivalent fstinfo fstintersect fstinvert \
fstmap fstminimize fstprint fstproject fstprune fstpush fstrandgen \
fstrelabel fstreplace fstreverse fstreweight fstrmepsilon \
fstshortestdistance fstshortestpath fstsynchronize fsttopsort fstunion
fstshortestdistance fstshortestpath fstsymbols fstsynchronize fsttopsort \
fstunion
fstarcsort_SOURCES = fstarcsort.cc
fstarcsort_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstarcsort_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstclosure_SOURCES = fstclosure.cc
fstclosure_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstclosure_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstcompile_SOURCES = fstcompile.cc
fstcompile_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstcompile_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstcompose_SOURCES = fstcompose.cc
fstcompose_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstcompose_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstconcat_SOURCES = fstconcat.cc
fstconcat_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstconcat_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstconnect_SOURCES = fstconnect.cc
fstconnect_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstconnect_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstconvert_SOURCES = fstconvert.cc
fstconvert_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstconvert_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstdeterminize_SOURCES = fstdeterminize.cc
fstdeterminize_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstdeterminize_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstdifference_SOURCES = fstdifference.cc
fstdifference_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstdifference_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstdraw_SOURCES = fstdraw.cc
fstdraw_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstdraw_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstencode_SOURCES = fstencode.cc
fstencode_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstencode_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstepsnormalize_SOURCES = fstepsnormalize.cc
fstepsnormalize_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstepsnormalize_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstequal_SOURCES = fstequal.cc
fstequal_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstequal_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstequivalent_SOURCES = fstequivalent.cc
fstequivalent_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstequivalent_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstinfo_SOURCES = fstinfo.cc
fstinfo_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstinfo_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstintersect_SOURCES = fstintersect.cc
fstintersect_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstintersect_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstinvert_SOURCES = fstinvert.cc
fstinvert_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstinvert_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstmap_SOURCES = fstmap.cc
fstmap_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstmap_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstminimize_SOURCES = fstminimize.cc
fstminimize_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstminimize_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstprint_SOURCES = fstprint.cc
fstprint_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstprint_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstproject_SOURCES = fstproject.cc
fstproject_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstproject_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstprune_SOURCES = fstprune.cc
fstprune_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstprune_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstpush_SOURCES = fstpush.cc
fstpush_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstpush_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstrandgen_SOURCES = fstrandgen.cc
fstrandgen_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstrandgen_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstrelabel_SOURCES = fstrelabel.cc
fstrelabel_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstrelabel_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstreplace_SOURCES = fstreplace.cc
fstreplace_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstreplace_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstreverse_SOURCES = fstreverse.cc
fstreverse_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstreverse_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstreweight_SOURCES = fstreweight.cc
fstreweight_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstreweight_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstrmepsilon_SOURCES = fstrmepsilon.cc
fstrmepsilon_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstrmepsilon_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstshortestdistance_SOURCES = fstshortestdistance.cc
fstshortestdistance_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstshortestdistance_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstshortestpath_SOURCES = fstshortestpath.cc
fstshortestpath_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstshortestpath_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstsymbols_SOURCES = fstsymbols.cc
fstsymbols_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstsynchronize_SOURCES = fstsynchronize.cc
fstsynchronize_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstsynchronize_LDADD = ../script/libfstscript.la ../lib/libfst.la
fsttopsort_SOURCES = fsttopsort.cc
fsttopsort_LDADD = ../lib/libfst.la ../script/libfstscript.la
fsttopsort_LDADD = ../script/libfstscript.la ../lib/libfst.la
fstunion_SOURCES = fstunion.cc
fstunion_LDADD = ../lib/libfst.la ../script/libfstscript.la
fstunion_LDADD = ../script/libfstscript.la ../lib/libfst.la
endif
\ No newline at end of file
This diff is collapsed.
// fstsymbols.cc
// 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.
//
// Copyright 2005-2010 Google, Inc.
// Author: allauzen@google.com (Cyril Allauzen)
// Modified: jpr@google.com (Jake Ratkiewicz) to use FstClass
//
// \file
// Performs operations (set, clear, relabel) on the symbols table
// attached to the input Fst.
//
#include <fst/script/fst-class.h>
#include <fst/script/script-impl.h>
#include <fst/util.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_bool(allow_negative_labels, false,
"Allow negative labels (not recommended; may cause conflicts)");
int main(int argc, char **argv) {
namespace s = fst::script;
using fst::SymbolTable;
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);
SetFlags(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
}
string in_fname = argc > 1 && strcmp(argv[1], "-") != 0 ? argv[1] : "";
string out_fname = argc > 2 ? argv[2] : "";
s::FstClass *ifst = s::FstClass::Read(in_fname);
if (!ifst) return 1;
s::MutableFstClass *ofst = 0;
if (ifst->Properties(fst::kMutable, false)) {
ofst = static_cast<s::MutableFstClass *>(ifst);
} else {
ofst = new s::VectorFstClass(*ifst);
delete ifst;
}
if (FLAGS_clear_isymbols)
ofst->SetInputSymbols(0);
else if (!FLAGS_isymbols.empty())
ofst->SetInputSymbols(
SymbolTable::ReadText(FLAGS_isymbols, FLAGS_allow_negative_labels));
if (FLAGS_clear_osymbols)
ofst->SetOutputSymbols(0);
else if (!FLAGS_osymbols.empty())
ofst->SetOutputSymbols(
SymbolTable::ReadText(FLAGS_osymbols, FLAGS_allow_negative_labels));
if (!FLAGS_relabel_ipairs.empty()) {
typedef int64 Label;
vector<pair<Label, Label> > ipairs;
fst::ReadLabelPairs(FLAGS_relabel_ipairs, &ipairs,
FLAGS_allow_negative_labels);
SymbolTable *isyms = RelabelSymbolTable(ofst->InputSymbols(), ipairs);
ofst->SetInputSymbols(isyms);
delete isyms;
}
if (!FLAGS_relabel_opairs.empty()) {
typedef int64 Label;
vector<pair<Label, Label> > opairs;
fst::ReadLabelPairs(FLAGS_relabel_opairs, &opairs,
FLAGS_allow_negative_labels);
SymbolTable *osyms = RelabelSymbolTable(ofst->OutputSymbols(), opairs);
ofst->SetOutputSymbols(osyms);
delete osyms;
}
ofst->Write(out_fname);
return 0;
}
......@@ -2,18 +2,26 @@ AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS)
AM_LDFLAGS = $(ICU_LIBS) -lm -ldl
libfstdir = @libfstdir@
libfst_LTLIBRARIES = libfstfar.la libfstfarscript.la
if HAVE_SCRIPT
libfst_LTLIBRARIES = libfstfarscript.la libfstfar.la
else
libfst_LTLIBRARIES = libfstfar.la
endif
libfstfar_la_SOURCES = sttable.cc
libfstfar_la_LDFLAGS = -version-info 0:0:0
if HAVE_SCRIPT
libfstfarscript_la_SOURCES = farscript.cc compile-strings.cc main.cc
libfstfarscript_la_LDFLAGS = -version-info 0:0:0
endif
if HAVE_BIN
bin_PROGRAMS = farcompilestrings farcreate farextract farinfo farprintstrings
farbindeps = ../../lib/libfst.la ../../script/libfstscript.la \
libfstfar.la libfstfarscript.la
farbindeps = libfstfarscript.la libfstfar.la ../../script/libfstscript.la \
../../lib/libfst.la
farcompilestrings_SOURCES = farcompilestrings.cc
farcompilestrings_LDADD = $(farbindeps)
......@@ -29,3 +37,4 @@ farinfo_LDADD = $(farbindeps)
farprintstrings_SOURCES = farprintstrings.cc
farprintstrings_LDADD = $(farbindeps)
endif
\ No newline at end of file
......@@ -33,8 +33,9 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = farcompilestrings$(EXEEXT) farcreate$(EXEEXT) \
farextract$(EXEEXT) farinfo$(EXEEXT) farprintstrings$(EXEEXT)
@HAVE_BIN_TRUE@bin_PROGRAMS = farcompilestrings$(EXEEXT) \
@HAVE_BIN_TRUE@ farcreate$(EXEEXT) farextract$(EXEEXT) \
@HAVE_BIN_TRUE@ farinfo$(EXEEXT) farprintstrings$(EXEEXT)
subdir = src/extensions/far
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
......@@ -61,30 +62,41 @@ libfstfar_la_OBJECTS = $(am_libfstfar_la_OBJECTS)
libfstfar_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(libfstfar_la_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_SCRIPT_FALSE@am_libfstfar_la_rpath = -rpath $(libfstdir)
@HAVE_SCRIPT_TRUE@am_libfstfar_la_rpath = -rpath $(libfstdir)
libfstfarscript_la_LIBADD =
am_libfstfarscript_la_OBJECTS = farscript.lo compile-strings.lo \
main.lo
am__libfstfarscript_la_SOURCES_DIST = farscript.cc compile-strings.cc \
main.cc
@HAVE_SCRIPT_TRUE@am_libfstfarscript_la_OBJECTS = farscript.lo \
@HAVE_SCRIPT_TRUE@ compile-strings.lo main.lo
libfstfarscript_la_OBJECTS = $(am_libfstfarscript_la_OBJECTS)
libfstfarscript_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(libfstfarscript_la_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_SCRIPT_TRUE@am_libfstfarscript_la_rpath = -rpath $(libfstdir)
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_farcompilestrings_OBJECTS = farcompilestrings.$(OBJEXT)
am__farcompilestrings_SOURCES_DIST = farcompilestrings.cc
@HAVE_BIN_TRUE@am_farcompilestrings_OBJECTS = \
@HAVE_BIN_TRUE@ farcompilestrings.$(OBJEXT)
farcompilestrings_OBJECTS = $(am_farcompilestrings_OBJECTS)
farcompilestrings_DEPENDENCIES = $(farbindeps)
am_farcreate_OBJECTS = farcreate.$(OBJEXT)
@HAVE_BIN_TRUE@farcompilestrings_DEPENDENCIES = $(farbindeps)
am__farcreate_SOURCES_DIST = farcreate.cc
@HAVE_BIN_TRUE@am_farcreate_OBJECTS = farcreate.$(OBJEXT)
farcreate_OBJECTS = $(am_farcreate_OBJECTS)
farcreate_DEPENDENCIES = $(farbindeps)
am_farextract_OBJECTS = farextract.$(OBJEXT)
@HAVE_BIN_TRUE@farcreate_DEPENDENCIES = $(farbindeps)
am__farextract_SOURCES_DIST = farextract.cc
@HAVE_BIN_TRUE@am_farextract_OBJECTS = farextract.$(OBJEXT)
farextract_OBJECTS = $(am_farextract_OBJECTS)
farextract_DEPENDENCIES = $(farbindeps)
am_farinfo_OBJECTS = farinfo.$(OBJEXT)
@HAVE_BIN_TRUE@farextract_DEPENDENCIES = $(farbindeps)
am__farinfo_SOURCES_DIST = farinfo.cc
@HAVE_BIN_TRUE@am_farinfo_OBJECTS = farinfo.$(OBJEXT)
farinfo_OBJECTS = $(am_farinfo_OBJECTS)
farinfo_DEPENDENCIES = $(farbindeps)
am_farprintstrings_OBJECTS = farprintstrings.$(OBJEXT)
@HAVE_BIN_TRUE@farinfo_DEPENDENCIES = $(farbindeps)
am__farprintstrings_SOURCES_DIST = farprintstrings.cc
@HAVE_BIN_TRUE@am_farprintstrings_OBJECTS = farprintstrings.$(OBJEXT)
farprintstrings_OBJECTS = $(am_farprintstrings_OBJECTS)
farprintstrings_DEPENDENCIES = $(farbindeps)
@HAVE_BIN_TRUE@farprintstrings_DEPENDENCIES = $(farbindeps)
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
......@@ -101,10 +113,12 @@ SOURCES = $(libfstfar_la_SOURCES) $(libfstfarscript_la_SOURCES) \
$(farcompilestrings_SOURCES) $(farcreate_SOURCES) \
$(farextract_SOURCES) $(farinfo_SOURCES) \
$(farprintstrings_SOURCES)
DIST_SOURCES = $(libfstfar_la_SOURCES) $(libfstfarscript_la_SOURCES) \
$(farcompilestrings_SOURCES) $(farcreate_SOURCES) \
$(farextract_SOURCES) $(farinfo_SOURCES) \
$(farprintstrings_SOURCES)
DIST_SOURCES = $(libfstfar_la_SOURCES) \
$(am__libfstfarscript_la_SOURCES_DIST) \
$(am__farcompilestrings_SOURCES_DIST) \
$(am__farcreate_SOURCES_DIST) $(am__farextract_SOURCES_DIST) \
$(am__farinfo_SOURCES_DIST) \
$(am__farprintstrings_SOURCES_DIST)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
......@@ -224,24 +238,25 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS)
AM_LDFLAGS = $(ICU_LIBS) -lm -ldl
libfst_LTLIBRARIES = libfstfar.la libfstfarscript.la
@HAVE_SCRIPT_FALSE@libfst_LTLIBRARIES = libfstfar.la
@HAVE_SCRIPT_TRUE@libfst_LTLIBRARIES = libfstfarscript.la libfstfar.la
libfstfar_la_SOURCES = sttable.cc
libfstfar_la_LDFLAGS = -version-info 0:0:0
libfstfarscript_la_SOURCES = farscript.cc compile-strings.cc main.cc
libfstfarscript_la_LDFLAGS = -version-info 0:0:0
farbindeps = ../../lib/libfst.la ../../script/libfstscript.la \
libfstfar.la libfstfarscript.la
farcompilestrings_SOURCES = farcompilestrings.cc
farcompilestrings_LDADD = $(farbindeps)
farcreate_SOURCES = farcreate.cc
farcreate_LDADD = $(farbindeps)
farextract_SOURCES = farextract.cc
farextract_LDADD = $(farbindeps)
farinfo_SOURCES = farinfo.cc
farinfo_LDADD = $(farbindeps)
farprintstrings_SOURCES = farprintstrings.cc
farprintstrings_LDADD = $(farbindeps)
@HAVE_SCRIPT_TRUE@libfstfarscript_la_SOURCES = farscript.cc compile-strings.cc main.cc
@HAVE_SCRIPT_TRUE@libfstfarscript_la_LDFLAGS = -version-info 0:0:0
@HAVE_BIN_TRUE@farbindeps = libfstfarscript.la libfstfar.la ../../script/libfstscript.la \
@HAVE_BIN_TRUE@ ../../lib/libfst.la
@HAVE_BIN_TRUE@farcompilestrings_SOURCES = farcompilestrings.cc
@HAVE_BIN_TRUE@farcompilestrings_LDADD = $(farbindeps)
@HAVE_BIN_TRUE@farcreate_SOURCES = farcreate.cc
@HAVE_BIN_TRUE@farcreate_LDADD = $(farbindeps)
@HAVE_BIN_TRUE@farextract_SOURCES = farextract.cc
@HAVE_BIN_TRUE@farextract_LDADD = $(farbindeps)
@HAVE_BIN_TRUE@farinfo_SOURCES = farinfo.cc
@HAVE_BIN_TRUE@farinfo_LDADD = $(farbindeps)
@HAVE_BIN_TRUE@farprintstrings_SOURCES = farprintstrings.cc
@HAVE_BIN_TRUE@farprintstrings_LDADD = $(farbindeps)
all: all-am
.SUFFIXES:
......@@ -303,9 +318,9 @@ clean-libfstLTLIBRARIES:
rm -f "$${dir}/so_locations"; \
done
libfstfar.la: $(libfstfar_la_OBJECTS) $(libfstfar_la_DEPENDENCIES)
$(libfstfar_la_LINK) -rpath $(libfstdir) $(libfstfar_la_OBJECTS) $(libfstfar_la_LIBADD) $(LIBS)
$(libfstfar_la_LINK) $(am_libfstfar_la_rpath) $(libfstfar_la_OBJECTS) $(libfstfar_la_LIBADD) $(LIBS)
libfstfarscript.la: $(libfstfarscript_la_OBJECTS) $(libfstfarscript_la_DEPENDENCIES)
$(libfstfarscript_la_LINK) -rpath $(libfstdir) $(libfstfarscript_la_OBJECTS) $(libfstfarscript_la_LIBADD) $(LIBS)
$(libfstfarscript_la_LINK) $(am_libfstfarscript_la_rpath) $(libfstfarscript_la_OBJECTS) $(libfstfarscript_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
......
......@@ -59,7 +59,7 @@ FarEntryType StringToFarEntryType(const string &s) {
} else if (s == "file") {
return FET_FILE;
} else {
LOG(ERROR) << "Unknown FAR entry type: " << s;
LOG(FATAL) << "Unknown FAR entry type: " << s;
return FET_LINE; // compiler requires return
}
}
......@@ -72,7 +72,7 @@ FarTokenType StringToFarTokenType(const string &s) {
} else if (s == "utf8") {
return FTT_UTF8;
} else {
LOG(ERROR) << "Unknown FAR entry type: " << s;
LOG(FATAL) << "Unknown FAR entry type: " << s;
return FTT_SYMBOL; // compiler requires return
}
}
......
AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS)
AM_LDFLAGS = -lm -ldl
if HAVE_BIN
bin_PROGRAMS = pdtcompose pdtexpand pdtreplace
pdtbindeps = ../../lib/libfst.la ../../script/libfstscript.la \
libfstpdt.la
pdtbindeps = libfstpdtscript.la ../../script/libfstscript.la \
../../lib/libfst.la
pdtcompose_SOURCES = pdtcompose.cc
pdtcompose_LDADD = $(pdtbindeps)
......@@ -14,9 +15,12 @@ pdtexpand_LDADD = $(pdtbindeps)
pdtreplace_SOURCES = pdtreplace.cc
pdtreplace_LDADD = $(pdtbindeps)
endif
libfstdir = @libfstdir@
libfst_LTLIBRARIES = libfstpdt.la
libfstpdt_la_SOURCES = pdtscript.cc
libfstpdt_la_LDFLAGS = -version-info 0:0:0
if HAVE_SCRIPT
libfst_LTLIBRARIES = libfstpdtscript.la
libfstpdtscript_la_SOURCES = pdtscript.cc
libfstpdtscript_la_LDFLAGS = -version-info 0:0:0
endif
......@@ -33,8 +33,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = pdtcompose$(EXEEXT) pdtexpand$(EXEEXT) \
pdtreplace$(EXEEXT)
@HAVE_BIN_TRUE@bin_PROGRAMS = pdtcompose$(EXEEXT) pdtexpand$(EXEEXT) \
@HAVE_BIN_TRUE@ pdtreplace$(EXEEXT)
subdir = src/extensions/pdt
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
......@@ -55,23 +55,28 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libfstdir)" "$(DESTDIR)$(bindir)"
libfstLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(libfst_LTLIBRARIES)
libfstpdt_la_LIBADD =
am_libfstpdt_la_OBJECTS = pdtscript.lo
libfstpdt_la_OBJECTS = $(am_libfstpdt_la_OBJECTS)
libfstpdt_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
libfstpdtscript_la_LIBADD =
am__libfstpdtscript_la_SOURCES_DIST = pdtscript.cc
@HAVE_SCRIPT_TRUE@am_libfstpdtscript_la_OBJECTS = pdtscript.lo
libfstpdtscript_la_OBJECTS = $(am_libfstpdtscript_la_OBJECTS)
libfstpdtscript_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(libfstpdt_la_LDFLAGS) $(LDFLAGS) -o $@
$(CXXFLAGS) $(libfstpdtscript_la_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_SCRIPT_TRUE@am_libfstpdtscript_la_rpath = -rpath $(libfstdir)
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_pdtcompose_OBJECTS = pdtcompose.$(OBJEXT)
am__pdtcompose_SOURCES_DIST = pdtcompose.cc
@HAVE_BIN_TRUE@am_pdtcompose_OBJECTS = pdtcompose.$(OBJEXT)
pdtcompose_OBJECTS = $(am_pdtcompose_OBJECTS)
pdtcompose_DEPENDENCIES = $(pdtbindeps)
am_pdtexpand_OBJECTS = pdtexpand.$(OBJEXT)
@HAVE_BIN_TRUE@pdtcompose_DEPENDENCIES = $(pdtbindeps)
am__pdtexpand_SOURCES_DIST = pdtexpand.cc
@HAVE_BIN_TRUE@am_pdtexpand_OBJECTS = pdtexpand.$(OBJEXT)
pdtexpand_OBJECTS = $(am_pdtexpand_OBJECTS)
pdtexpand_DEPENDENCIES = $(pdtbindeps)
am_pdtreplace_OBJECTS = pdtreplace.$(OBJEXT)
@HAVE_BIN_TRUE@pdtexpand_DEPENDENCIES = $(pdtbindeps)
am__pdtreplace_SOURCES_DIST = pdtreplace.cc
@HAVE_BIN_TRUE@am_pdtreplace_OBJECTS = pdtreplace.$(OBJEXT)
pdtreplace_OBJECTS = $(am_pdtreplace_OBJECTS)
pdtreplace_DEPENDENCIES = $(pdtbindeps)
@HAVE_BIN_TRUE@pdtreplace_DEPENDENCIES = $(pdtbindeps)
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
......@@ -84,10 +89,11 @@ CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libfstpdt_la_SOURCES) $(pdtcompose_SOURCES) \
$(pdtexpand_SOURCES) $(pdtreplace_SOURCES)
DIST_SOURCES = $(libfstpdt_la_SOURCES) $(pdtcompose_SOURCES) \
SOURCES = $(libfstpdtscript_la_SOURCES) $(pdtcompose_SOURCES) \
$(pdtexpand_SOURCES) $(pdtreplace_SOURCES)
DIST_SOURCES = $(am__libfstpdtscript_la_SOURCES_DIST) \
$(am__pdtcompose_SOURCES_DIST) $(am__pdtexpand_SOURCES_DIST) \
$(am__pdtreplace_SOURCES_DIST)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
......@@ -207,18 +213,18 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(srcdir)/../../include $(ICU_CPPFLAGS)
AM_LDFLAGS = -lm -ldl
pdtbindeps = ../../lib/libfst.la ../../script/libfstscript.la \
libfstpdt.la
pdtcompose_SOURCES = pdtcompose.cc
pdtcompose_LDADD = $(pdtbindeps)
pdtexpand_SOURCES = pdtexpand.cc
pdtexpand_LDADD = $(pdtbindeps)
pdtreplace_SOURCES = pdtreplace.cc
pdtreplace_LDADD = $(pdtbindeps)
libfst_LTLIBRARIES = libfstpdt.la
libfstpdt_la_SOURCES = pdtscript.cc
libfstpdt_la_LDFLAGS = -version-info 0:0:0
@HAVE_BIN_TRUE@pdtbindeps = libfstpdtscript.la ../../script/libfstscript.la \
@HAVE_BIN_TRUE@ ../../lib/libfst.la
@HAVE_BIN_TRUE@pdtcompose_SOURCES = pdtcompose.cc
@HAVE_BIN_TRUE@pdtcompose_LDADD = $(pdtbindeps)
@HAVE_BIN_TRUE@pdtexpand_SOURCES = pdtexpand.cc
@HAVE_BIN_TRUE@pdtexpand_LDADD = $(pdtbindeps)
@HAVE_BIN_TRUE@pdtreplace_SOURCES = pdtreplace.cc
@HAVE_BIN_TRUE@pdtreplace_LDADD = $(pdtbindeps)
@HAVE_SCRIPT_TRUE@libfst_LTLIBRARIES = libfstpdtscript.la
@HAVE_SCRIPT_TRUE@libfstpdtscript_la_SOURCES = pdtscript.cc
@HAVE_SCRIPT_TRUE@libfstpdtscript_la_LDFLAGS = -version-info 0:0:0
all: all-am
.SUFFIXES:
......@@ -279,8 +285,8 @@ clean-libfstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libfstpdt.la: $(libfstpdt_la_OBJECTS) $(libfstpdt_la_DEPENDENCIES)
$(libfstpdt_la_LINK) -rpath $(libfstdir) $(libfstpdt_la_OBJECTS) $(libfstpdt_la_LIBADD) $(LIBS)
libfstpdtscript.la: $(libfstpdtscript_la_OBJECTS) $(libfstpdtscript_la_DEPENDENCIES)
$(libfstpdtscript_la_LINK) $(am_libfstpdtscript_la_rpath) $(libfstpdtscript_la_OBJECTS) $(libfstpdtscript_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
......
......@@ -60,8 +60,10 @@ int main(int argc, char **argv) {
s::FstClass *ifst2 = s::FstClass::Read(in2_name);
if (!ifst2) return 1;
if (FLAGS_pdt_parentheses.empty())
if (FLAGS_pdt_parentheses.empty()) {
LOG(ERROR) << argv[0] << ": No PDT parenthesis label pairs provided";
return 1;
}
vector<pair<int64, int64> > parens;
fst::ReadLabelPairs(FLAGS_pdt_parentheses, &parens, false);
......
......@@ -44,8 +44,10 @@ int main(int argc, char **argv) {
s::FstClass *ifst = s::FstClass::Read(argv[1]);
if (!ifst) return 1;
if (FLAGS_pdt_parentheses.empty())
if (FLAGS_pdt_parentheses.empty()) {
LOG(ERROR) << argv[0] << ": No PDT parenthesis label pairs provided";
return 1;
}
vector<pair<int64, int64> > parens;
fst::ReadLabelPairs(FLAGS_pdt_parentheses, &parens, false);
......
......@@ -50,9 +50,9 @@ void PdtCompose(const FstClass &ifst1,
}
void PdtExpand(const FstClass &ifst,
const vector<pair<int64, int64> > &labels,
const vector<pair<int64, int64> > &parens,
MutableFstClass *ofst, bool connect) {
PdtExpandArgs args(ifst, labels, ofst, connect);
PdtExpandArgs args(ifst, parens, ofst, connect);
Apply<Operation<PdtExpandArgs> >("PdtExpand", ifst.ArcType(), &args);
}
......
......@@ -36,7 +36,7 @@ class ArcMergeCompare {
if (x.ilabel < y.ilabel) return true;
if (x.ilabel > y.ilabel) return false;
if (x.olabel < y.olabel) return true;
if (x.olabel < y.olabel) return false;
if (x.olabel > y.olabel) return false;
if (x.nextstate < y.nextstate) return true;
if (x.nextstate > y.nextstate) return false;
return false;
......
......@@ -40,7 +40,7 @@ namespace fst {
// before the sort.
//
// Complexity:
// - Time: O(V + D log D)
// - Time: O(V D log D)
// - Space: O(D)
// where V = # of states and D = maximum out-degree.
template<class Arc, class Compare>
......@@ -185,8 +185,8 @@ class ArcSortFstImpl : public CacheImpl<A> {
// known properties.
//
// Complexity:
// - Time: O(v + d log d)
// - Space: O(v + d)
// - Time: O(v d log d)
// - Space: O(d)
// where v = # of states visited, d = maximum out-degree of states
// visited. Constant time and space to visit an input state is assumed
// and exclusive of caching.
...