MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / _flagged_text

Function _flagged_text

scripts/developer-guide/run_languagetool.py:494–504  ·  view source on GitHub ↗

Extract the substring the match flagged. language_tool_python returns m.context (the snippet) and m.offsetInContext / m.errorLength. The flagged token is at m.context[offsetInContext:offsetInContext+errorLength].

(m)

Source from the content-addressed store, hash-verified

492
493
494def _flagged_text(m):
495 """Extract the substring the match flagged.
496
497 language_tool_python returns m.context (the snippet) and
498 m.offsetInContext / m.errorLength. The flagged token is at
499 m.context[offsetInContext:offsetInContext+errorLength].
500 """
501 ctx = _attr(m, "context", default="") or ""
502 off = _attr(m, "offset_in_context", "offsetInContext", default=0) or 0
503 length = _attr(m, "error_length", "errorLength", default=0) or 0
504 return ctx[off:off + length]
505
506
507def _attr(obj, *names, default=None):

Callers 1

run_languagetoolFunction · 0.85

Calls 1

_attrFunction · 0.85

Tested by

no test coverage detected