fix(understand): the bare Russian "to" before a panel is a wiring callout

A Russian P&ID often closes a load's text with the panel it is wired to:
'... кВт' on one line, then 'к CP1' ('to CP1') or 'к щиту CP-2' ('to
switchboard CP-2') on the next. wiring_target knew 'подключение к ...' but
not the bare preposition. On the field P&ID most loads therefore had no
panel and no measurable cable.

The preposition к / ко now counts when it is a whole word and the panel is
the next word, optionally after щиту / шкафу / панели. The к of кВт is
never read as the preposition. The new test failed before the change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
Umut CAN
2026-09-24 16:10:24 +03:00
co-authored by Claude Opus 5.5
parent 77cb325467
commit db5b4d3ef8
3 changed files with 27 additions and 2 deletions
+10
View File
@@ -212,6 +212,16 @@ def test_wiring_callouts_in_four_languages():
assert wiring_target("CP 2 panosuna") == "CP-2"
def test_the_russian_to_before_a_panel_is_a_wiring_callout():
# A Russian P&ID closes a load's text with the panel it is wired to: 'к CP1'
# ('to CP1'), or 'к щиту CP-2' ('to switchboard CP-2'). The unit кВт holds
# the same letter and is no preposition.
assert wiring_target("к CP1") == "CP-1"
assert wiring_target("P = 2,2 кВт\nк CP1") == "CP-1"
assert wiring_target("к щиту CP-2") == "CP-2"
assert wiring_target("P = 2,2 кВт") is None
def test_a_callout_without_a_wiring_phrase_names_no_panel():
assert wiring_target("CP1") is None
assert wiring_target("Wiring to") is None