MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _format_direction_label

Function _format_direction_label

agents/reading-agent/main.py:1152–1173  ·  view source on GitHub ↗
(direction: str, response_language: str = "zh")

Source from the content-addressed store, hash-verified

1150
1151
1152def _format_direction_label(direction: str, response_language: str = "zh") -> str:
1153 language = _normalize_response_language(response_language)
1154 normalized = str(direction or "").strip()
1155 if not normalized:
1156 return "Current direction" if language == "en" else "当前方向"
1157 formatter = getattr(direction_lexicon, "format_direction_label", None)
1158 if callable(formatter):
1159 label = str(formatter(normalized, prefer_chinese=(language != "en")) or "").strip()
1160 if label:
1161 return label
1162 lowered = normalized.lower()
1163 if language == "en":
1164 return (
1165 normalized.replace("-", " ").replace("_", " ").title().replace("Gui", "GUI").replace("Ai", "AI")
1166 )
1167 if lowered in DIRECTION_LABELS:
1168 return DIRECTION_LABELS[lowered]
1169 if any("\u4e00" <= ch <= "\u9fff" for ch in normalized):
1170 return normalized
1171 return (
1172 normalized.replace("-", " ").replace("_", " ").title().replace("Gui", "GUI").replace("Ai", "AI")
1173 )
1174
1175
1176def _format_authors(authors: Any) -> str:

Callers 2

_build_relevance_pointsFunction · 0.85

Calls 1

Tested by

no test coverage detected