OCR: support the opening calibration order's plain-prose target line
'Target is at- Q4 4:2' (no #id, unlike the usual block shape) is how the game's very first order gives the target. Store it as a fixed (UNKNOWN, "1") entry since there's only ever one.
This commit is contained in:
parent
ba6b07a476
commit
139601b107
@ -54,6 +54,7 @@ def ocr_text(image: Image.Image) -> str:
|
|||||||
|
|
||||||
NEST_KEYWORD = "IRON NEST"
|
NEST_KEYWORD = "IRON NEST"
|
||||||
SPOTTER_KEYWORD = "SPOTTER"
|
SPOTTER_KEYWORD = "SPOTTER"
|
||||||
|
TARGET_IS_AT_KEYWORD = "Target is at"
|
||||||
_FUZZY_THRESHOLD = 0.65
|
_FUZZY_THRESHOLD = 0.65
|
||||||
|
|
||||||
|
|
||||||
@ -446,6 +447,16 @@ def parse_text(text: str) -> ParsedInfo:
|
|||||||
if spotter_id is not None and coord is not None:
|
if spotter_id is not None and coord is not None:
|
||||||
info.spotters[spotter_id] = coord
|
info.spotters[spotter_id] = coord
|
||||||
|
|
||||||
|
# The game's opening calibration order gives the target as plain
|
||||||
|
# prose ("Target is at- Q4 4:2") rather than the usual "Target#N:"
|
||||||
|
# block shape, there's only ever one of these, so it's stored under
|
||||||
|
# a fixed id ("1") rather than one parsed from the text.
|
||||||
|
if (TargetType.UNKNOWN, "1") not in info.targets and _fuzzy_contains(line, TARGET_IS_AT_KEYWORD):
|
||||||
|
coord = _extract_coord(line)
|
||||||
|
if coord is not None:
|
||||||
|
info.targets[(TargetType.UNKNOWN, "1")] = (line, [], coord)
|
||||||
|
continue
|
||||||
|
|
||||||
for entry in parse_intel_blocks(text):
|
for entry in parse_intel_blocks(text):
|
||||||
if entry["kind"] == "rp":
|
if entry["kind"] == "rp":
|
||||||
info.reference_points[entry["name"]] = (entry["raw"], entry["clues"], entry["coord"])
|
info.reference_points[entry["name"]] = (entry["raw"], entry["clues"], entry["coord"])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user