Normalize engine hints such as mineru-iet to mineru. Also strips an engine-level parameter block, so a stored/encoded ``parse_engine`` like ``mineru(page_range=1-3)`` resolves to the bare engine ``mineru`` (the single chokepoint that keeps parser selection and engine comparisons wor
(engine: Any)
| 72 | |
| 73 | |
| 74 | def normalize_parser_engine(engine: Any) -> str: |
| 75 | """Normalize engine hints such as mineru-iet to mineru. |
| 76 | |
| 77 | Also strips an engine-level parameter block, so a stored/encoded |
| 78 | ``parse_engine`` like ``mineru(page_range=1-3)`` resolves to the bare |
| 79 | engine ``mineru`` (the single chokepoint that keeps parser selection and |
| 80 | engine comparisons working once params are encoded into ``parse_engine``). |
| 81 | """ |
| 82 | text = str(engine or "").strip() |
| 83 | paren = text.find("(") |
| 84 | if paren != -1: |
| 85 | text = text[:paren] |
| 86 | return text.split("-", 1)[0].strip().lower() |
| 87 | |
| 88 | |
| 89 | def encode_parse_engine(engine: str, engine_params: Mapping[str, Any] | None) -> str: |