Skip to content

Commit

Permalink
engine: Add more debug messages
Browse files Browse the repository at this point in the history
engine/dictionary.py
engine/engine.py
  • Loading branch information
ShikiOkasaka committed Jul 23, 2024
1 parent e8678c3 commit 7e9e24c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions engine/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,14 @@ def lookup_yougen(self) -> (int, str, str):
yomi = word
shrunk = ''
while yomi not in self._dict:
LOGGER.debug(f'lookup_yougen: {yomi}')
shrunk += yomi[0]
yomi = yomi[1:]
# Check shrunken entries that look like,
# にし― / ['に知r']
m = RE_PREFIX.search(self._dict[yomi][0])
if m and yomi.startswith(m.group()):
LOGGER.debug(f'lookup_yougen: "{shrunk}" {yomi}')
shrunk += m.group()
yomi = yomi[m.end():]
return i, shrunk, yomi
Expand Down
2 changes: 1 addition & 1 deletion engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def _assist(self, text, pos):
return 0

yougen, yougen_shrunk, yougen_yomi = self._dict.lookup_yougen()
LOGGER.debug(f'_assist: {yougen}, {yougen_shrunk}, {yougen_yomi}')
LOGGER.debug(f'_assist: {yougen}, "{yougen_shrunk}", {yougen_yomi}')

self._assisted = llm.pick(prefix, cand, yougen, yougen_shrunk, yougen_yomi)
LOGGER.debug(f'_assist: "{cand[self._assisted]}"/"{yomi}" ({self._assisted})')
Expand Down

0 comments on commit 7e9e24c

Please sign in to comment.