Macaulay2 Engine
Loading...
Searching...
No Matches

◆ leftOverlaps()

void WordTable::leftOverlaps ( std::vector< Overlap > & newLeftOverlaps) const

Definition at line 227 of file WordTable.cpp.

228{
229 // word here is the last word in the dictionary.
230 // For left overlap: dictword is a word in the dictionary NOT word.
231 // For right overlap: dictword is any word in the dictionary.
232 // A left overlap: suffix(dictword) == prefix(word)
233 // A right overlap: prefix(dictword) == suffix(word).
234 // if dictword == word, a match will be a right overlap, NOT a left overlap.
235 // A returned triple:
236 // (left overlap):
237
238 int word_index = mMonomials.size()-1;
239 std::vector<int> overlap_indices;
240 for (int i=0; i<word_index; ++i)
241 {
242 overlap_indices.clear();
243 overlaps(mMonomials[i], mMonomials[word_index], overlap_indices);
244 for (auto j : overlap_indices)
245 newLeftOverlaps.push_back(std::make_tuple(i, j, word_index,true));
246 }
247 // triples will be <dict word index, index into dict word where suffix starts, word_index>.
248}
std::vector< Word > mMonomials
static void overlaps(Word word1, Word word2, std::vector< int > &result_overlaps)

References mMonomials, and overlaps().

Referenced by TEST().