Skip to content

Commit

Permalink
fix: kana vocabulary lessons (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajite authored Nov 1, 2023
1 parent 55e8f56 commit acdd131
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions hebikani/hebikani.py
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,9 @@ def ask_answer(self, question: Question):
Returns:
AnswerType: The answer type.
"""
prompt = f"{question.subject.object} - {question.question_type}: "
prompt = (
f"{question.subject.object.replace('_', ' ')} - {question.question_type}: "
)

# Display the number of answers for the question in hard mode.
# Some kanji require multiple answers while their vocabulary only need one.
Expand Down Expand Up @@ -1488,7 +1490,10 @@ def lesson_interface(self, subject: Subject):
tab_index = 0
while True:
clear_terminal()
print(f"{subject.object.capitalize()}:\n\n{subject.characters}\n")
print(
f"{subject.object.capitalize().replace('_', ' ')}:"
f"\n\n{subject.characters}\n"
)
tabs = ["composition", "meaning", "reading", "context"]
if (
subject.object == SubjectObject.VOCABULARY
Expand All @@ -1500,6 +1505,8 @@ def lesson_interface(self, subject: Subject):
tabs = ["meaning"]
elif subject.object == SubjectObject.KANJI:
tabs = ["composition", "meaning", "reading"]
elif subject.object == SubjectObject.KANA_VOCABULARY:
tabs = ["meaning"]

print(self.beautify_tabs_display(tabs, tab_index))
print("\n")
Expand Down Expand Up @@ -1538,7 +1545,8 @@ def tab_composition(self, subject: Subject) -> str:
if subject.component_subject_ids:
subjects = self.client._subject_per_ids(subject.component_subject_ids)
res = (
f"This {subject.object} is made of {len(subjects)} {subjects[0].object}"
f"This {subject.object.replace('_', ' ')} is made of "
+ f"{len(subjects)} {subjects[0].object}"
+ ":\n"
+ "\n".join(
f"- {s.characters}: {s.meanings.primary.value}" for s in subjects
Expand Down

0 comments on commit acdd131

Please sign in to comment.