MCPcopy Create free account
hub / github.com/clips/pattern / analyze

Method analyze

pattern/web/pdf/layout.py:613–635  ·  view source on GitHub ↗
(self, laparams)

Source from the content-addressed store, hash-verified

611 return list(plane)
612
613 def analyze(self, laparams):
614 # textobjs is a list of LTChar objects, i.e.
615 # it has all the individual characters in the page.
616 (textobjs, otherobjs) = fsplit(lambda obj: isinstance(obj, LTChar), self._objs)
617 for obj in otherobjs:
618 obj.analyze(laparams)
619 if not textobjs: return
620 textlines = list(self.get_textlines(laparams, textobjs))
621 assert len(textobjs) <= sum( len(line._objs) for line in textlines )
622 (empties, textlines) = fsplit(lambda obj: obj.is_empty(), textlines)
623 for obj in empties:
624 obj.analyze(laparams)
625 textboxes = list(self.get_textboxes(laparams, textlines))
626 assert len(textlines) == sum( len(box._objs) for box in textboxes )
627 groups = self.group_textboxes(laparams, textboxes)
628 assigner = IndexAssigner()
629 for group in groups:
630 group.analyze(laparams)
631 assigner.run(group)
632 textboxes.sort(key=lambda box:box.index)
633 self._objs = textboxes + otherobjs + empties
634 self.groups = groups
635 return
636
637
638## LTFigure

Callers

nothing calls this directly

Calls 11

get_textlinesMethod · 0.95
get_textboxesMethod · 0.95
group_textboxesMethod · 0.95
runMethod · 0.95
fsplitFunction · 0.90
lenFunction · 0.85
sumFunction · 0.85
IndexAssignerClass · 0.85
is_emptyMethod · 0.80
analyzeMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected