i18n
This commit is contained in:
1 parent
40ae451bef
commit
74c57f9433
7 files changed
+88
-48
No files matched your search
+12
-12
@@ -2,7 +2,7 @@ import copy
|
||||
import random
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
from katrain.core.common import evaluation_class, var_to_grid
|
||||
from katrain.core.common import evaluation_class, var_to_grid, i18n
|
||||
from katrain.core.sgf_parser import Move, SGFNode
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class GameNode(SGFNode):
|
||||
properties["C"] = ["\n".join(properties.get("C", "")) + comment]
|
||||
if self.is_root:
|
||||
properties["C"] = [
|
||||
"Moves marked 'X' indicate the top move according to KataGo, those with a square are moves that lose less than 0.5 points.\n"
|
||||
i18n._("SGF start message") + "\n"
|
||||
+ "\n".join(properties.get("C", ""))
|
||||
+ "\nSGF with review generated by KaTrain."
|
||||
]
|
||||
@@ -137,29 +137,29 @@ class GameNode(SGFNode):
|
||||
if previous_top_move["move"] != single_move.gtp():
|
||||
points_lost = self.points_lost
|
||||
if sgf and points_lost > 0.5:
|
||||
text += f"Estimated point loss: {points_lost:.1f}\n"
|
||||
text += f"Predicted top move was {previous_top_move['move']} ({self.format_score(previous_top_move['scoreLead'])}).\n"
|
||||
text += i18n._("Info:point loss").format(points=points_lost) + "\n"
|
||||
text += i18n._("Info:top move").format(top_move=previous_top_move['move'],score=self.format_score(previous_top_move['scoreLead'])) +".\n"
|
||||
else:
|
||||
text += f"Move was predicted best move.\n"
|
||||
text += i18n._("Info:best move")+"\n"
|
||||
if previous_top_move.get("pv") and (sgf or hints):
|
||||
text += f"PV: {self.make_pv(single_move.player,previous_top_move['pv'],interactive)}\n"
|
||||
text += i18n._("Info:PV") + ": " + self.make_pv(single_move.player,previous_top_move['pv'],interactive) + "\n"
|
||||
|
||||
if sgf or hints or teach:
|
||||
policy_ranking = self.parent.policy_ranking
|
||||
currmove_policy_with_ix = [(ix + 1, p) for (p, m), ix in zip(policy_ranking, range(len(policy_ranking))) if m == single_move]
|
||||
if currmove_policy_with_ix:
|
||||
text += f"Move was #{currmove_policy_with_ix[0][0]} according to policy ({currmove_policy_with_ix[0][1]:.2%}).\n"
|
||||
text += i18n._("Info:policy rank").format(rank=currmove_policy_with_ix[0][0],probability=currmove_policy_with_ix[0][1]) + "\n"
|
||||
if not currmove_policy_with_ix or currmove_policy_with_ix[0] != 1 and (sgf or hints):
|
||||
text += f"Top policy move was {policy_ranking[0][1].gtp()} ({policy_ranking[0][0]:.1%}).\n"
|
||||
text += i18n._("Info:policy best").format(move=policy_ranking[0][1].gtp(),probability=policy_ranking[0][0]) +".\n"
|
||||
if self.auto_undo and sgf:
|
||||
text += "Move was automatically undone in teaching mode.\n"
|
||||
text += i18n._("Info:teaching undo") + "\n"
|
||||
top_pv = self.analysis_ready and self.candidate_moves[0].get("pv")
|
||||
if top_pv:
|
||||
text += f"Predicted follow-up: {self.next_player}{' '.join(top_pv)}\n"
|
||||
text += i18n._("Info:undo predicted PV").format(pv=f"{self.next_player}{' '.join(top_pv)}") + "\n"
|
||||
if self.ai_thoughts and (sgf or hints):
|
||||
text += f"\nAI thought process: {self.ai_thoughts}"
|
||||
text += "\n" + i18n._("Info:AI thoughts").format(thoughts=self.ai_thoughts)
|
||||
else:
|
||||
text = "No analysis available" if sgf else "Analyzing move..."
|
||||
text = i18n._("No analysis available") if sgf else i18n._("Analyzing move...")
|
||||
return text
|
||||
|
||||
@property
|
||||
|
||||
Reference in new issue
Block a user