Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef fst::StdVectorFst GRAPH;
- GRAPH _graph1, _graph2;
- //...
- typedef fst::LabelLookAheadMatcher<fst::SortedMatcher<GRAPH>, fst::olabel_lookahead_flags> LOOK_MATCHER;
- typedef fst::SortedMatcher<GRAPH> SORTED_MATCHER;
- typedef fst::SequenceComposeFilter<LOOK_MATCHER, SORTED_MATCHER> SEQ_FILTER;
- typedef fst::LookAheadComposeFilter<SEQ_FILTER, LOOK_MATCHER, SORTED_MATCHER, fst::MATCH_OUTPUT> LOOK_COMPOSE_FILTER;
- typedef fst::PushWeightsComposeFilter<LOOK_COMPOSE_FILTER, LOOK_MATCHER, SORTED_MATCHER, fst::MATCH_OUTPUT> PUSH_WEIGHTS_FILTER;
- typedef fst::PushLabelsComposeFilter<PUSH_WEIGHTS_FILTER, LOOK_MATCHER, SORTED_MATCHER, fst::MATCH_OUTPUT> PUSH_LABELS_FILTER;
- typedef PUSH_LABELS_FILTER COMPOSE_FILTER;
- // My compose options
- fst::CacheOptions cacheOptions;
- fst::ComposeFstImplOptions<LOOK_MATCHER, SORTED_MATCHER, COMPOSE_FILTER> composeOptions(cacheOptions);
- composeOptions.matcher1 = new LOOK_MATCHER(_graph1, fst::MATCH_OUTPUT);
- //Relabel _graph1 such as fst::StdOLabelLookAheadFst graph1Look(_graph1);
- LOOK_MATCHER::MatcherData* matcherData = composeOptions.matcher1->GetData();
- fst::LabelReachable<Arc> graph1Reachable(matcherData);
- std::auto_ptr<GRAPH> graph1Relabeled(&_graph1);
- graph1Reachable.Relabel(graph1Relabeled.get(), false);
- graph1Relabeled->SetInputSymbols(NULL);
- //Relabel _graph2 such as fst::LabelLookAheadRelabeler<GRAPH::Arc>::Relabel(graph2TrueRelabel.get(), graph1Look, true);
- fst::LabelReachable<Arc> graph2Reachable(matcherData);
- std::auto_ptr<GRAPH> graph2Relabeled(&_graph2);
- graph2Reachable.Relabel(graph2Relabeled.get(), true);
- fst::ArcSort(graph2Relabeled.get(), fst::StdILabelCompare());
- composeOptions.matcher2 = new SORTED_MATCHER(*graph2Relabeled.get(), fst::MATCH_INPUT);
- composeOptions.filter = new COMPOSE_FILTER(*graph1Relabeled.get(), *graph2Relabeled.get(), composeOptions.matcher1, composeOptions.matcher2);
- std::auto_ptr<GRAPH> composedRes(new GRAPH);
- *composedRes = fst::ComposeFst<Arc>(*graph1Relabeled.get(), *graph2Relabeled.get(), composeOptions);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement