Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some cleanups #4963

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ if(BuildForFedora)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

#find_package(PkgConfig REQUIRED)

#pkg_check_modules(FST REQUIRED fst)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
else()
include(third_party/get_third_party)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ then build the package as follows:

```
cmake -S ./ -Bbuild/Release -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DBuildForFedora=ON
cmake --build /home/gerhard/workspace/kaldi/build/Release
cmake --build ./build/Release
```


Expand Down
6 changes: 3 additions & 3 deletions src/chain/chain-den-graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void CreateDenominatorFst(const ContextDependency &ctx_dep,
// previously an acceptor, so we project, i.e. copy the ilabels to the
// olabels
AddSubsequentialLoop(subsequential_symbol, &phone_lm);
fst::Project(&phone_lm, fst::PROJECT_INPUT);
fst::Project(&phone_lm, fst::ProjectType::INPUT);
}
std::vector<int32> disambig_syms; // empty list of disambiguation symbols.

Expand All @@ -330,7 +330,7 @@ void CreateDenominatorFst(const ContextDependency &ctx_dep,
// at this point, context_dep_lm will have indexes into 'ilabels' as its
// input symbol (representing context-dependent phones), and phones on its
// output. We don't need the phones, so we'll project.
fst::Project(&context_dep_lm, fst::PROJECT_INPUT);
fst::Project(&context_dep_lm, fst::ProjectType::INPUT);

KALDI_LOG << "Number of states and arcs in context-dependent LM FST is "
<< context_dep_lm.NumStates() << " and " << NumArcs(context_dep_lm);
Expand Down Expand Up @@ -365,7 +365,7 @@ void CreateDenominatorFst(const ContextDependency &ctx_dep,
// context-dependent phones (indexes into IlabelInfo()) as its olabels.
// Discard the context-dependent phones by projecting on the input, keeping
// only the transition-ids.
fst::Project(&transition_id_fst, fst::PROJECT_INPUT);
fst::Project(&transition_id_fst, fst::ProjectType::INPUT);

MapFstToPdfIdsPlusOne(trans_model, &transition_id_fst);
KALDI_LOG << "Number of states and arcs in transition-id FST is "
Expand Down
8 changes: 4 additions & 4 deletions src/chain/chain-supervision.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ bool ProtoSupervisionToSupervision(
// previously an acceptor, so we project, i.e. copy the ilabels to the
// olabels
AddSubsequentialLoop(subsequential_symbol, &phone_fst);
fst::Project(&phone_fst, fst::PROJECT_INPUT);
fst::Project(&phone_fst, fst::ProjectType::INPUT);
}

// inv_cfst will be expanded on the fly, as needed.
Expand All @@ -325,7 +325,7 @@ bool ProtoSupervisionToSupervision(
// 'inv_cfst.IlabelInfo()' as its input symbol (representing context-dependent
// phones), and phones on its output. We don't need the phones, so we'll
// project.
fst::Project(&context_dep_fst, fst::PROJECT_INPUT);
fst::Project(&context_dep_fst, fst::ProjectType::INPUT);

std::vector<int32> disambig_syms_h; // disambiguation symbols on input side of
// H -- will be empty, as there were no
Expand Down Expand Up @@ -364,7 +364,7 @@ bool ProtoSupervisionToSupervision(
// context-dependent phones (indexes into ILabelInfo()) as its olabels.
// Discard the context-dependent phones by projecting on the input, keeping
// only the transition-ids.
fst::Project(&transition_id_fst, fst::PROJECT_INPUT);
fst::Project(&transition_id_fst, fst::ProjectType::INPUT);
if (transition_id_fst.Properties(fst::kIEpsilons, true) != 0) {
// remove epsilons, if there are any.
fst::RmEpsilon(&transition_id_fst);
Expand All @@ -385,7 +385,7 @@ bool ProtoSupervisionToSupervision(
if (convert_to_pdfs) {
// at this point supervision->fst will have pdf-ids plus one as the olabels,
// but still transition-ids as the ilabels. Copy olabels to ilabels.
fst::Project(&(supervision->fst), fst::PROJECT_OUTPUT);
fst::Project(&(supervision->fst), fst::ProjectType::OUTPUT);
}

KALDI_ASSERT(supervision->fst.Properties(fst::kIEpsilons, true) == 0);
Expand Down
2 changes: 1 addition & 1 deletion src/fstbin/fsts-project.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) {
std::string key = fst_reader.Key();
VectorFst<StdArc> fst(fst_reader.Value());

Project(&fst, project_output ? PROJECT_OUTPUT : PROJECT_INPUT);
Project(&fst, project_output ? ProjectType::OUTPUT : ProjectType::INPUT);

fst_writer.Write(key, fst);
n_done++;
Expand Down
2 changes: 1 addition & 1 deletion src/fstext/context-fst.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void ComposeContext(const vector<int32> &disambig_syms_in,
if (central_position != context_width-1) {
AddSubsequentialLoop(subseq_sym, ifst);
if (project_ifst) {
fst::Project(ifst, fst::PROJECT_INPUT);
fst::Project(ifst, fst::ProjectType::INPUT);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fstext/kaldi-fst-io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fst::VectorFst<fst::StdArc> *ReadAndPrepareLmFst(std::string rxfilename) {
// symbol #0 on the input symbols of the backoff arc, and projection will
// replace them with epsilons which is what is on the output symbols of
// those arcs.
fst::Project(ans, fst::PROJECT_OUTPUT);
fst::Project(ans, fst::ProjectType::OUTPUT);
}
if (ans->Properties(fst::kILabelSorted, true) == 0) {
// Make sure LM is sorted on ilabel.
Expand Down
2 changes: 1 addition & 1 deletion src/lat/word-align-lattice-lexicon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class LatticeLexiconWordAligner {
std::vector<int32> syms_to_remove;
syms_to_remove.push_back(kTemporaryEpsilon);
RemoveSomeInputSymbols(syms_to_remove, lat_out_);
Project(lat_out_, fst::PROJECT_INPUT);
Project(lat_out_, fst::ProjectType::INPUT);
}

bool AlignLattice() {
Expand Down
4 changes: 2 additions & 2 deletions src/lat/word-align-lattice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class LatticeWordAligner {
syms_to_remove.push_back(info_.silence_label);
if (!syms_to_remove.empty()) {
RemoveSomeInputSymbols(syms_to_remove, lat_out_);
Project(lat_out_, fst::PROJECT_INPUT);
Project(lat_out_, fst::ProjectType::INPUT);
}
}

Expand Down Expand Up @@ -890,7 +890,7 @@ class WordAlignedLatticeTester {
std::vector<int32> to_remove;
to_remove.push_back(info_.silence_label);
RemoveSomeInputSymbols(to_remove, &aligned_lat);
Project(&aligned_lat, fst::PROJECT_INPUT);
Project(&aligned_lat, fst::ProjectType::INPUT);
}

if (!RandEquivalent(lat_, aligned_lat, 5/*paths*/, 1.0e+10/*delta*/, Rand()/*seed*/,
Expand Down
2 changes: 1 addition & 1 deletion src/latbin/lattice-interp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int main(int argc, char *argv[]) {

Lattice lat2;
ConvertLattice(clat2, &lat2);
fst::Project(&lat2, fst::PROJECT_OUTPUT); // project on words.
fst::Project(&lat2, fst::ProjectType::OUTPUT); // project on words.
ScaleLattice(fst::LatticeScale(1.0-alpha, 1.0-alpha), &lat2);
ArcSort(&lat2, fst::ILabelCompare<LatticeArc>());

Expand Down
4 changes: 2 additions & 2 deletions src/latbin/lattice-oracle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void ConvertLatticeToUnweightedAcceptor(const kaldi::Lattice &ilat,
fst::ConvertLattice(ilat, ofst);
// remove weights, project to output, sort according to input arg
fst::Map(ofst, fst::RmWeightMapper<fst::StdArc>());
fst::Project(ofst, fst::PROJECT_OUTPUT); // The words are on the output side
fst::Project(ofst, fst::ProjectType::OUTPUT); // The words are on the output side
fst::Relabel(ofst, wildcards, wildcards);
fst::RmEpsilon(ofst); // Don't tolerate epsilons as they make it hard to
// tally errors
Expand Down Expand Up @@ -367,7 +367,7 @@ int main(int argc, char *argv[]) {
fst::ArcSort(&clat, fst::ILabelCompare<CompactLatticeArc>());
fst::Compose(oracle_clat_mask, clat, &oracle_clat_mask);
fst::ShortestPath(oracle_clat_mask, &oracle_clat);
fst::Project(&oracle_clat, fst::PROJECT_OUTPUT);
fst::Project(&oracle_clat, fst::ProjectType::OUTPUT);
TopSortCompactLatticeIfNeeded(&oracle_clat);

if (oracle_clat.Start() == fst::kNoStateId) {
Expand Down
4 changes: 2 additions & 2 deletions src/latbin/lattice-project.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) {
RemoveAlignmentsFromCompactLattice(&clat);
Lattice lat;
ConvertLattice(clat, &lat);
fst::Project(&lat, fst::PROJECT_OUTPUT); // project on words.
fst::Project(&lat, fst::ProjectType::OUTPUT); // project on words.
lattice_writer.Write(key, lat);
n_done++;
}
Expand All @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
std::string key = lattice_reader.Key();
Lattice lat = lattice_reader.Value();
lattice_reader.FreeCurrent();
fst::Project(&lat, fst::PROJECT_INPUT);
fst::Project(&lat, fst::ProjectType::INPUT);
lattice_writer.Write(key, lat);
n_done++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/latbin/lattice-to-fst.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
// extra states because already removed alignments.
ConvertLattice(lat, &fst); // this adds up the (lm,acoustic) costs to get
// the normal (tropical) costs.
Project(&fst, fst::PROJECT_OUTPUT); // Because in the standard Lattice format,
Project(&fst, fst::ProjectType::OUTPUT); // Because in the standard Lattice format,
// the words are on the output, and we want the word labels.
}
if (rm_eps) RemoveEpsLocal(&fst);
Expand Down
2 changes: 1 addition & 1 deletion src/nnet2/nnet-example-functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void DiscriminativeExampleSplitter::CollapseTransitionIds() {
void DiscriminativeExampleSplitter::PrepareLattice(bool first_time) {
::fst::ConvertLattice(eg_.den_lat, &lat_);

Project(&lat_, fst::PROJECT_INPUT); // Get rid of the word labels and put the
Project(&lat_, fst::ProjectType::INPUT); // Get rid of the word labels and put the
// transition-ids on both sides.

RmEpsilon(&lat_); // Remove epsilons.. this simplifies
Expand Down
2 changes: 1 addition & 1 deletion src/nnet3/discriminative-supervision.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void DiscriminativeSupervisionSplitter::CreateRangeLattice(

// Get rid of the word labels and put the
// transition-ids on both sides.
fst::Project(out_lat, fst::PROJECT_INPUT);
fst::Project(out_lat, fst::ProjectType::INPUT);
fst::RmEpsilon(out_lat);

if (config_.collapse_transition_ids)
Expand Down
Loading