Yield tuples of automaton matches as (match end, match value) from matching the ``tokens`` sequence of token ids starting at the `qbegin` absolute query start position position using the `automaton`.
(tokens, qbegin, automaton)
| 177 | |
| 178 | |
| 179 | def get_matches(tokens, qbegin, automaton): |
| 180 | """ |
| 181 | Yield tuples of automaton matches as (match end, match value) from matching |
| 182 | the ``tokens`` sequence of token ids starting at the `qbegin` absolute query |
| 183 | start position position using the `automaton`. |
| 184 | """ |
| 185 | # iterate over matched strings: the matched value is (rule id, index start |
| 186 | # pos, index end pos) |
| 187 | qtokens = tuple(tokens) |
| 188 | for qend, matched_value in automaton.iter(qtokens): |
| 189 | qend = qbegin + qend + 1 |
| 190 | yield qend, matched_value |
| 191 | |
| 192 | |
| 193 | def match_fragments(idx, query_run): |
no outgoing calls
no test coverage detected