MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / yield_unique_chars

Function yield_unique_chars

src/table.py:879–888  ·  view source on GitHub ↗
(chars: list)

Source from the content-addressed store, hash-verified

877 pos_key = itemgetter("doctop", "x0")
878
879 def yield_unique_chars(chars: list):
880 sorted_chars = sorted(chars, key=key)
881 for grp, grp_chars in itertools.groupby(sorted_chars, key=key):
882 for y_cluster in cluster_objects(
883 list(grp_chars), itemgetter("doctop"), tolerance
884 ):
885 for x_cluster in cluster_objects(
886 y_cluster, itemgetter("x0"), tolerance
887 ):
888 yield sorted(x_cluster, key=pos_key)[0]
889
890 deduped = yield_unique_chars(chars)
891 return sorted(deduped, key=chars.index)

Callers 1

dedupe_charsFunction · 0.85

Calls 1

cluster_objectsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…