diff --git a/alib2algo/src/stringology/matching/GeneralizedLevenshteinMatchingAutomaton.h b/alib2algo/src/stringology/matching/GeneralizedLevenshteinMatchingAutomaton.h index df4a211f2a766ad8aeb29a34d2adff6f0b368c9d..1524ed4b4f8a139d630457ad7c7fce20b17e66c1 100644 --- a/alib2algo/src/stringology/matching/GeneralizedLevenshteinMatchingAutomaton.h +++ b/alib2algo/src/stringology/matching/GeneralizedLevenshteinMatchingAutomaton.h @@ -33,9 +33,9 @@ template < class SymbolType > automaton::EpsilonNFA < SymbolType, void, ext::pair<unsigned int, unsigned int> > GeneralizedLevenshteinMatchingAutomaton::construct(const string::LinearString < SymbolType > & pattern, unsigned int allowed_errors) { automaton::EpsilonNFA < SymbolType, void, ext::pair<unsigned int, unsigned int> > result = stringology::matching::LevenshteinMatchingAutomaton::construct(pattern, allowed_errors); - for (unsigned int i = 0; i<pattern.getContent().size(); i++) { - for (unsigned int j = 0; j<allowed_errors; j++) { - if (i>=j && i+1 < pattern.getContent().size()) { + for (unsigned int j = 0; j<allowed_errors; j++) { + for (unsigned int i = j; i<pattern.getContent().size(); i++) { + if (i+1 < pattern.getContent().size()) { auto from = ext::make_pair(i, j); auto transpose_state = ext::make_pair(pattern.getContent().size()+1+i, j); auto to = ext::make_pair(i+2, j+1);