1 2// Licensed under the Apache License, Version 2.0 (the "License"); 3// you may not use this file except in compliance with the License. 4// You may obtain a copy of the License at 5// 6// http://www.apache.org/licenses/LICENSE-2.0 7// 8// Unless required by applicable law or agreed to in writing, software 9// distributed under the License is distributed on an "AS IS" BASIS, 10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11// See the License for the specific language governing permissions and 12// limitations under the License. 13// 14// Copyright 2005-2010 Google, Inc. 15// Author: jpr@google.com (Jake Ratkiewicz) 16 17#include <fst/script/fst-class.h> 18#include <fst/script/script-impl.h> 19#include <fst/script/equivalent.h> 20 21namespace fst { 22namespace script { 23 24bool Equivalent(const FstClass &fst1, const FstClass &fst2, 25 float delta) { 26 if (!ArcTypesMatch(fst1, fst2, "Equivalent")) return false; 27 28 EquivalentInnerArgs args(fst1, fst2, kDelta); 29 EquivalentArgs args_with_retval(args); 30 31 Apply<Operation<EquivalentArgs> >("Equivalent", fst1.ArcType(), 32 &args_with_retval); 33 34 return args_with_retval.retval; 35} 36 37REGISTER_FST_OPERATION(Equivalent, StdArc, EquivalentArgs); 38REGISTER_FST_OPERATION(Equivalent, LogArc, EquivalentArgs); 39REGISTER_FST_OPERATION(Equivalent, Log64Arc, EquivalentArgs); 40 41} // namespace script 42} // namespace fst 43