|
16 | 16 | (".tag", "tag"))
|
17 | 17 |
|
18 | 18 |
|
| 19 | +def float_or_disabled(x): |
| 20 | + if x.lower().strip() == "disabled": |
| 21 | + return x |
| 22 | + try: |
| 23 | + x = float(x) |
| 24 | + except ValueError: |
| 25 | + raise argparse.ArgumentTypeError("invalid float value: {}".format(x)) |
| 26 | + |
| 27 | + |
19 | 28 | def extract_text(files=[], outfile='-',
|
20 | 29 | no_laparams=False, all_texts=None, detect_vertical=None,
|
21 | 30 | word_margin=None, char_margin=None, line_margin=None,
|
@@ -120,14 +129,14 @@ def maketheparser():
|
120 | 129 | "be part of the same paragraph. The margin is specified "
|
121 | 130 | "relative to the height of a line.")
|
122 | 131 | la_params.add_argument(
|
123 |
| - "--boxes-flow", "-F", type=float, default=0.5, |
| 132 | + "--boxes-flow", "-F", type=float_or_disabled, default=0.5, |
124 | 133 | help="Specifies how much a horizontal and vertical position of a "
|
125 | 134 | "text matters when determining the order of lines. The value "
|
126 | 135 | "should be within the range of -1.0 (only horizontal position "
|
127 | 136 | "matters) to +1.0 (only vertical position matters). You can also "
|
128 |
| - "pass `None` to disable advanced layout analysis, and instead " |
129 |
| - "return text based on the position of the bottom left corner of " |
130 |
| - "the text box.") |
| 137 | + "pass `disabled` to disable advanced layout analysis, and " |
| 138 | + "instead return text based on the position of the bottom left " |
| 139 | + "corner of the text box.") |
131 | 140 | la_params.add_argument(
|
132 | 141 | "--all-texts", "-A", default=False, action="store_true",
|
133 | 142 | help="If layout analysis should be performed on text in figures.")
|
|
0 commit comments