Use shared item axis context in role routes
This commit is contained in:
@@ -3,19 +3,15 @@ from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
try:
|
||||
from . import item_axis_policy
|
||||
from . import outercourse_action_policy as outercourse_policy
|
||||
except ImportError: # Allows local smoke tests with top-level imports.
|
||||
import item_axis_policy
|
||||
import outercourse_action_policy as outercourse_policy
|
||||
|
||||
|
||||
def _context_text(item_text: str, item_axis_values: dict[str, Any] | None) -> str:
|
||||
return " ".join(
|
||||
str(part or "").lower()
|
||||
for part in (
|
||||
item_text,
|
||||
*((item_axis_values or {}).values()),
|
||||
)
|
||||
)
|
||||
return item_axis_policy.context_text(item_text, axis_values=item_axis_values)
|
||||
|
||||
|
||||
def build_outercourse_role_graph(
|
||||
@@ -25,7 +21,7 @@ def build_outercourse_role_graph(
|
||||
item_axis_values: dict[str, Any] | None = None,
|
||||
pov_labels: list[str] | None = None,
|
||||
) -> str:
|
||||
position_text = str((item_axis_values or {}).get("position") or "").lower()
|
||||
position_text = item_axis_policy.key_text(item_axis_values, "position")
|
||||
text = _context_text(item_text, item_axis_values)
|
||||
action_kind = outercourse_policy.infer_outercourse_action_kind(position_text)
|
||||
if action_kind == outercourse_policy.OUTERCOURSE_GENERIC:
|
||||
|
||||
Reference in New Issue
Block a user