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

Allow Kanji equivalent for various words #257

Open
ryanone opened this issue Mar 7, 2024 · 1 comment
Open

Allow Kanji equivalent for various words #257

ryanone opened this issue Mar 7, 2024 · 1 comment
Labels
suggestion Suggest a new feature or improvement

Comments

@ryanone
Copy link
Contributor

ryanone commented Mar 7, 2024

There are certain words that are frequently used in answers, and as of now, only the pure Hiragana versions are considered valid:

  1. おいしい ー 「美味しい」は使えません。「おいしい」だけは使えます。
  2. 友だち ー 「友達」は使えません。「友だち」だけは使えます。

It's been my experience that popup suggestions while typing, will show the version of the word that contains the Kanji characters. I can create a PR if you're in agreement. Thanks for making this amazing learning tool!

@ryanone ryanone changed the title Allow Kanji equivalent for おいしい Allow Kanji equivalent for various words Mar 7, 2024
@SethClydesdale
Copy link
Owner

Hello!

You're free to make a PR to implement these variations if you like! I've already done a course of implementing support for ともだち、友達 and 友だち, before, but there is the chance I've missed some. I'll leave info on how the answer fields work below.

Normally for a single answer, the field looks like this: {答え}
For two or more answers it looks like this by adding the "answer" flag on the end: {答え1|答え2|答え3|answer} (only the first two answers are visible to the user)
For automating the generation of mixed kana/kanji answers we have a helper function called Genki.getAlts(). It's used in this fashion: brackets to capture a kanji in the first argument's sentence, and the kana definitions for the captured kanji in the second argument, separated by a horizontal bar.

{わたしのともだち|私の友だち|' + Genki.getAlts('{}{}{}', 'わたし|とも|だち') + 'answer}

Two visible answers, either in full kana or full kanji, and then multiple hidden sub-answers generated by Genki.getAlts(). For the above answer, it generates the following sub-answers allowing more liberal usage of kana or kanji.

私の友達
私の友だち
私のとも達
私のともだち
わたしの友達
わたしの友だち
わたしのとも達
わたしのともだち

You can take a look over this commit to get an idea of how additional kanji/kana variations are handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Suggest a new feature or improvement
Projects
None yet
Development

No branches or pull requests

2 participants