FST  openfst-1.8.3
OpenFst Library
shortest-distance.cc
Go to the documentation of this file.
1 // Copyright 2005-2024 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the 'License');
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an 'AS IS' BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // See www.openfst.org for extensive documentation on this weighted
16 // finite-state transducer library.
17 
19 
20 #include <vector>
21 
22 #include <fst/script/fst-class.h>
23 #include <fst/script/script-impl.h>
25 
26 namespace fst {
27 namespace script {
28 
29 void ShortestDistance(const FstClass &fst, std::vector<WeightClass> *distance,
30  const ShortestDistanceOptions &opts) {
31  FstShortestDistanceArgs1 args{fst, distance, opts};
32  Apply<Operation<FstShortestDistanceArgs1>>("ShortestDistance", fst.ArcType(),
33  &args);
34 }
35 
36 void ShortestDistance(const FstClass &fst, std::vector<WeightClass> *distance,
37  bool reverse, double delta) {
38  FstShortestDistanceArgs2 args{fst, distance, reverse, delta};
39  Apply<Operation<FstShortestDistanceArgs2>>("ShortestDistance", fst.ArcType(),
40  &args);
41 }
42 
43 WeightClass ShortestDistance(const FstClass &fst, double delta) {
44  FstShortestDistanceInnerArgs3 iargs{fst, delta};
45  FstShortestDistanceArgs3 args(iargs);
46  Apply<Operation<FstShortestDistanceArgs3>>("ShortestDistance", fst.ArcType(),
47  &args);
48  return args.retval;
49 }
50 
54 
55 } // namespace script
56 } // namespace fst
std::tuple< const FstClass &, std::vector< WeightClass > *, bool, double > FstShortestDistanceArgs2
REGISTER_FST_OPERATION_3ARCS(Compress, CompressArgs)
const std::string & ArcType() const final
Definition: fst-class.h:329
void ShortestDistance(FstShortestDistanceArgs1 *args)
std::tuple< const FstClass &, std::vector< WeightClass > *, const ShortestDistanceOptions & > FstShortestDistanceArgs1
std::tuple< const FstClass &, double > FstShortestDistanceInnerArgs3