SethClydesdale / genki-study-resources

A collection of exercises for practicing what is taught in Genki: An Integrated Course in Elementary Japanese.
https://sethclydesdale.github.io/genki-study-resources/lessons-3rd/
MIT License
822 stars 280 forks source link

Multiple answer options #167

Closed justfeedbacktoo closed 1 year ago

justfeedbacktoo commented 2 years ago

Is there a way to give multiple options for multiple sets of words in answers like below instead of making a compete sentence for every combination?

(私/わたし)は(日本語/にほんご)の(先生/せんせい)です

SethClydesdale commented 2 years ago

Hello @justfeedbacktoo!

For multiple combinations, I used Genki.getAlts which returns a list of alternative answers based on the provided combinations. General syntax looks something like this.

'{今日、図書館に行った|きょう、としょかんにいった|' + Genki.getAlts('{今日}、{図書館}に行{った}', 'きょう|としょかん|きました') + 'answer}'

In some rare instances you may need to use more than one of these, but they can be chained like so.

'{answer1|answer2|' + Genki.getAlts('', '|') + Genki.getAlts('', '|') + 'answer}'

On page, you can add ?debug to the end of the URL to return a list of all the alternative answers in the web console.

Screenshot 2022-06-06 113050

If any questions let me know.