diff options
author | Alexander Gutkin <agutkin@google.com> | 2012-09-12 18:11:43 +0100 |
---|---|---|
committer | Alexander Gutkin <agutkin@google.com> | 2012-09-12 18:11:43 +0100 |
commit | dfd8b8327b93660601d016cdc6f29f433b45a8d8 (patch) | |
tree | 968ec84b8e32ad73ec18d74334930f36b7471906 /src/include/fst/test-properties.h | |
parent | f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2 (diff) | |
download | openfst-dfd8b8327b93660601d016cdc6f29f433b45a8d8.tar.gz |
Updated OpenFST version to openfst-1.3.2-CL32004048 from Greco3.
Change-Id: I19b0db718256b35c0e3e5a7315f1ed6335e6dcac
Diffstat (limited to 'src/include/fst/test-properties.h')
-rw-r--r-- | src/include/fst/test-properties.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/include/fst/test-properties.h b/src/include/fst/test-properties.h index db1ddcc..12bcba7 100644 --- a/src/include/fst/test-properties.h +++ b/src/include/fst/test-properties.h @@ -125,13 +125,14 @@ uint64 ComputeProperties(const Fst<Arc> &fst, uint64 mask, uint64 *known, siter.Next()) { StateId s = siter.Value(); - Arc prev_arc(kNoLabel, kNoLabel, Weight::One(), 0); + Arc prev_arc; // Create these only if we need to if (mask & (kIDeterministic | kNonIDeterministic)) ilabels = new unordered_set<Label>; if (mask & (kODeterministic | kNonODeterministic)) olabels = new unordered_set<Label>; + bool first_arc = true; for (ArcIterator< Fst<Arc> > aiter(fst, s); !aiter.Done(); aiter.Next()) { @@ -161,13 +162,15 @@ uint64 ComputeProperties(const Fst<Arc> &fst, uint64 mask, uint64 *known, comp_props |= kOEpsilons; comp_props &= ~kNoOEpsilons; } - if (prev_arc.ilabel != kNoLabel && arc.ilabel < prev_arc.ilabel) { - comp_props |= kNotILabelSorted; - comp_props &= ~kILabelSorted; - } - if (prev_arc.olabel != kNoLabel && arc.olabel < prev_arc.olabel) { - comp_props |= kNotOLabelSorted; - comp_props &= ~kOLabelSorted; + if (!first_arc) { + if (arc.ilabel < prev_arc.ilabel) { + comp_props |= kNotILabelSorted; + comp_props &= ~kILabelSorted; + } + if (arc.olabel < prev_arc.olabel) { + comp_props |= kNotOLabelSorted; + comp_props &= ~kOLabelSorted; + } } if (arc.weight != Weight::One() && arc.weight != Weight::Zero()) { comp_props |= kWeighted; @@ -182,6 +185,7 @@ uint64 ComputeProperties(const Fst<Arc> &fst, uint64 mask, uint64 *known, comp_props &= ~kString; } prev_arc = arc; + first_arc = false; if (ilabels) ilabels->insert(arc.ilabel); if (olabels) |