@@ 1-30 (lines=30) @@ | ||
1 | def get_AllAlternativeImages(self, page=True, region=True, line=True, word=True, glyph=True): |
|
2 | """ |
|
3 | Get all the ``pc:AlternativeImage`` in a document |
|
4 | ||
5 | Arguments: |
|
6 | page (boolean): Get images on ``pc:Page`` level |
|
7 | region (boolean): Get images on ``pc:*Region`` level |
|
8 | line (boolean): Get images on ``pc:TextLine`` level |
|
9 | word (boolean): Get images on ``pc:Word`` level |
|
10 | glyph (boolean): Get images on ``pc:Glyph`` level |
|
11 | ||
12 | Returns: |
|
13 | a list of :py:class:`AlternativeImageType` |
|
14 | """ |
|
15 | ret = [] |
|
16 | if page: |
|
17 | ret += self.get_AlternativeImage() |
|
18 | for this_region in self.get_AllRegions(['Text']): |
|
19 | if region: |
|
20 | ret += this_region.get_AlternativeImage() |
|
21 | for this_line in this_region.get_TextLine(): |
|
22 | if line: |
|
23 | ret += this_line.get_AlternativeImage() |
|
24 | for this_word in this_line.get_Word(): |
|
25 | if word: |
|
26 | ret += this_word.get_AlternativeImage() |
|
27 | for this_glyph in this_word.get_Glyph(): |
|
28 | if glyph: |
|
29 | ret += this_glyph.get_AlternativeImage() |
|
30 | return ret |
|
31 | ||
32 |
@@ 3822-3851 (lines=30) @@ | ||
3819 | else: |
|
3820 | ret = in_reading_order + [r for r in ret if r not in in_reading_order] |
|
3821 | return ret |
|
3822 | def get_AllAlternativeImages(self, page=True, region=True, line=True, word=True, glyph=True): |
|
3823 | """ |
|
3824 | Get all the ``pc:AlternativeImage`` in a document |
|
3825 | ||
3826 | Arguments: |
|
3827 | page (boolean): Get images on ``pc:Page`` level |
|
3828 | region (boolean): Get images on ``pc:*Region`` level |
|
3829 | line (boolean): Get images on ``pc:TextLine`` level |
|
3830 | word (boolean): Get images on ``pc:Word`` level |
|
3831 | glyph (boolean): Get images on ``pc:Glyph`` level |
|
3832 | ||
3833 | Returns: |
|
3834 | a list of :py:class:`AlternativeImageType` |
|
3835 | """ |
|
3836 | ret = [] |
|
3837 | if page: |
|
3838 | ret += self.get_AlternativeImage() |
|
3839 | for this_region in self.get_AllRegions(['Text']): |
|
3840 | if region: |
|
3841 | ret += this_region.get_AlternativeImage() |
|
3842 | for this_line in this_region.get_TextLine(): |
|
3843 | if line: |
|
3844 | ret += this_line.get_AlternativeImage() |
|
3845 | for this_word in this_line.get_Word(): |
|
3846 | if word: |
|
3847 | ret += this_word.get_AlternativeImage() |
|
3848 | for this_glyph in this_word.get_Glyph(): |
|
3849 | if glyph: |
|
3850 | ret += this_glyph.get_AlternativeImage() |
|
3851 | return ret |
|
3852 | ||
3853 | def invalidate_AlternativeImage(self, feature_selector=None): |
|
3854 | """ |