sheleoni / hiragana-icecream

A React app for all to learn the basic alphabets in Japanese.
https://hiragana-icecream.sheleoni.com/
MIT License
1 stars 0 forks source link

Use LevelFilterData.js to choose letters that appear in the Question component #14

Closed sheleoni closed 1 year ago

sheleoni commented 1 year ago

Thought Process

Objective:

input array of [あ, た, ナ] → output [あ,い,う,え,お, た,ち,つ,て,と, ナ,ニ,ヌ,ネ,ノ]

image
  1. Read from LevelFilterData.js
  2. Filter out characters with a "true" value, e.g か : true さ : false た : false な : false は : false ま : false や : true
  3. Create a new array with characters that have the "true" value (i.e. const selectedCharacters = ["か","や"] in this example). May use OptionGroup.js as reference (probably add 'ア行' etc rows for katakana characters, and convert romaji to hiragana and katakana against their respective rows. Need to check. *Considering that we may allow users to filter individual letters instead of by rows in the future, it may be wiser to use choiceData.js):
const choices = {
    'あ行': ['a', 'i', 'u', 'e', 'o'],
    'か行': ['ka', 'ki', 'ku', 'ke', 'ko'],
    'が行': ['ga', 'gi', 'gu', 'ge', 'go'],
    'さ行': ['sa', 'shi', 'su', 'se', 'so'],
    'ざ行': ['za', 'ji', 'zu', 'ze', 'zo'],
    'た行': ['ta', 'chi', 'tsu', 'te', 'to'],
    'だ行': ['da', 'ji', 'zu', 'de', 'do'],
    'な行': ['na', 'ni', 'nu', 'ne', 'no'],
    'は行': ['ha', 'hi', 'fu', 'he', 'ho'],
    'ば行': ['ba', 'bi', 'bu', 'be', 'bo'],
    'ぱ行': ['pa', 'pi', 'pu', 'pe', 'po'],
    'ま行': ['ma', 'mi', 'mu', 'me', 'mo'],
    'や行': ['ya', 'yu', 'yo'],
    'ら行': ['ra', 'ri', 'ru', 're', 'ro'],
    'わ行': ['wa', 'wo', 'n'],
};
  1. From the selectedCharacters array, derive the candidate characters in the question pool (e.g. the か row contains か き く け and こ, and store the characters in the question pool in a one-dimensional array (i.e. const questionPool = ["か", "き", "く"m",け","こ","や","ゆ","よ"].