MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_matched_starts

Function get_matched_starts

src/licensedcode/match_aho.py:317–325  ·  view source on GitHub ↗

Yield tuples of matched positions as (qstart, [(rule_length, rule_id), ...). Match `tokens` sequence of token ids starting at the `qbegin` absolute query start position position using the `automaton`.

(tokens, qbegin, automaton, len_start=SMALL_RULE)

Source from the content-addressed store, hash-verified

315
316
317def get_matched_starts(tokens, qbegin, automaton, len_start=SMALL_RULE):
318 """
319 Yield tuples of matched positions as (qstart, [(rule_length, rule_id), ...).
320 Match `tokens` sequence of token ids starting at the `qbegin` absolute query
321 start position position using the `automaton`.
322 """
323 for qend, values in get_matches(tokens, qbegin, automaton):
324 qstart = qend - len_start
325 yield qstart, values

Callers 1

break_on_boundariesFunction · 0.90

Calls 1

get_matchesFunction · 0.70

Tested by

no test coverage detected