Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: kana vocabulary lessons #64

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading