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

refactor(data): Refactor wordSearch and other methods for clarity and maintainability #1436

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7c94ddc
refactor(data): Refactor wordSearch to use lookup
tora-pan Feb 28, 2023
2ea4ed6
refactor(data): Remove missed console.logs
tora-pan Feb 28, 2023
e509cd3
refactor(data): Cherry pick test from other branch to follow contrib …
tora-pan Feb 28, 2023
5b7d512
refactor(data): Remove commented out code
tora-pan Feb 28, 2023
b0770b5
Revert "refactor(data): Cherry pick test from other branch to follow …
tora-pan Feb 28, 2023
1e093f1
Revert "refactor(data): Remove commented out code"
tora-pan Feb 28, 2023
fcea7eb
refactor(data): Remove accidently added file
tora-pan Feb 28, 2023
968c518
test(visual): Update baselines with new screenshots
github-actions[bot] Feb 28, 2023
ddb8635
Merge branch 'main' into refactor(data)_refactor-word-search
melink14 Mar 1, 2023
ba9349a
refactor(data): Fix regression bug and clean up test styling
tora-pan Mar 1, 2023
8415bfa
refactor(data): Fix logic causing regression and test styling
tora-pan Mar 1, 2023
912fd4a
refactor(data): Replace null type to wordSearch
tora-pan Mar 1, 2023
2f5637b
test(visual): Update baselines with new screenshots
github-actions[bot] Mar 1, 2023
35a9eb6
refactor(data): Comment out exec path for web-test-runner
tora-pan Mar 3, 2023
8b5a4ce
refactor(data): Fix logic causing regressions
tora-pan Mar 3, 2023
bea4823
Merge branch 'main' into refactor(data)_refactor-word-search
tora-pan Mar 3, 2023
5a7a430
style: Fix lint/formatting errors
github-actions[bot] Mar 3, 2023
5994c34
refactor(data): Fix merge conflicts from different stashes
tora-pan Mar 3, 2023
4cf1bee
refactor(data): Fix stashing mess
tora-pan Mar 3, 2023
f9c922c
test(visual): Update baselines with new screenshots
github-actions[bot] Mar 3, 2023
a457d52
refactor(data): Move normalizationMap to own file
tora-pan Mar 3, 2023
912fc7a
style: Fix lint/formatting errors
github-actions[bot] Mar 3, 2023
a9815b7
refactor(data): Revert deinflect method and types
tora-pan Mar 4, 2023
5e6f6d2
refactor(data): Add non kana break to hiragana conversion
tora-pan Mar 4, 2023
9e9af02
refactor(data): Fix selection regression bug, remove console log
tora-pan Mar 5, 2023
4b4ca61
test(visual): Update baselines with new screenshots
github-actions[bot] Mar 5, 2023
61878fe
refactor(data): Revert execPath for web-test-runner-config
tora-pan Mar 5, 2023
ccc8bcd
test(visual): Update baselines with new screenshots
github-actions[bot] Mar 5, 2023
92431c4
refactor(data): Add explicit check for halfWidthKatakana to converToH…
tora-pan Mar 9, 2023
448994a
Merge remote-tracking branch 'upstream/main' into refactor(data)_refa…
tora-pan Mar 12, 2023
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
186 changes: 186 additions & 0 deletions extension/character_info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
export const kanaToHiraganaNormalizationMap: Record<string, string> = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be constant case? (and readonly I guess)

ァ: 'ぁ',
ア: 'あ',
ィ: 'ぃ',
イ: 'い',
ゥ: 'ぅ',
ウ: 'う',
ェ: 'ぇ',
エ: 'え',
ォ: 'ぉ',
オ: 'お',
カ: 'か',
ガ: 'が',
キ: 'き',
ギ: 'ぎ',
ク: 'く',
グ: 'ぐ',
ケ: 'け',
ゲ: 'げ',
コ: 'こ',
ゴ: 'ご',
サ: 'さ',
ザ: 'ざ',
シ: 'し',
ジ: 'じ',
ス: 'す',
ズ: 'ず',
セ: 'せ',
ゼ: 'ぜ',
ソ: 'そ',
ゾ: 'ぞ',
タ: 'た',
ダ: 'だ',
チ: 'ち',
ヂ: 'ぢ',
ッ: 'っ',
ツ: 'つ',
ヅ: 'づ',
テ: 'て',
デ: 'で',
ト: 'と',
ド: 'ど',
ナ: 'な',
ニ: 'に',
ヌ: 'ぬ',
ネ: 'ね',
ノ: 'の',
ハ: 'は',
バ: 'ば',
パ: 'ぱ',
ヒ: 'ひ',
ビ: 'び',
ピ: 'ぴ',
フ: 'ふ',
ブ: 'ぶ',
プ: 'ぷ',
ヘ: 'へ',
ベ: 'べ',
ペ: 'ぺ',
ホ: 'ほ',
ボ: 'ぼ',
ポ: 'ぽ',
マ: 'ま',
ミ: 'み',
ム: 'む',
メ: 'め',
モ: 'も',
ャ: 'ゃ',
ヤ: 'や',
ュ: 'ゅ',
ユ: 'ゆ',
ョ: 'ょ',
ヨ: 'よ',
ラ: 'ら',
リ: 'り',
ル: 'る',
レ: 'れ',
ロ: 'ろ',
ヮ: 'ゎ',
ワ: 'わ',
ヲ: 'を',
ン: 'ん',
ヴ: 'ゔ',
ァ: 'ぁ',
ア: 'あ',
ィ: 'ぃ',
イ: 'い',
ゥ: 'ぅ',
ウ: 'う',
ェ: 'ぇ',
エ: 'え',
ォ: 'ぉ',
オ: 'お',
カ: 'か',
ガ: 'が',
キ: 'き',
ギ: 'ぎ',
ク: 'く',
グ: 'ぐ',
ケ: 'け',
ゲ: 'げ',
コ: 'こ',
ゴ: 'ご',
サ: 'さ',
ザ: 'ざ',
シ: 'し',
ジ: 'じ',
ス: 'す',
ズ: 'ず',
セ: 'せ',
ゼ: 'ぜ',
ソ: 'そ',
ゾ: 'ぞ',
タ: 'た',
ダ: 'だ',
チ: 'ち',
ヂ: 'ぢ',
ッ: 'っ',
ツ: 'つ',
ヅ: 'づ',
テ: 'て',
デ: 'で',
ト: 'と',
ド: 'ど',
ナ: 'な',
ニ: 'に',
ヌ: 'ぬ',
ネ: 'ね',
ノ: 'の',
ハ: 'は',
バ: 'ば',
パ: 'ぱ',
ヒ: 'ひ',
ビ: 'び',
ピ: 'ぴ',
フ: 'ふ',
ブ: 'ぶ',
プ: 'ぷ',
ヘ: 'へ',
ベ: 'べ',
ペ: 'ぺ',
ホ: 'ほ',
ボ: 'ぼ',
ポ: 'ぽ',
マ: 'ま',
ミ: 'み',
ム: 'む',
メ: 'め',
モ: 'も',
ャ: 'ゃ',
ヤ: 'や',
ュ: 'ゅ',
ユ: 'ゆ',
ョ: 'ょ',
ヨ: 'よ',
ラ: 'ら',
リ: 'り',
ル: 'る',
レ: 'れ',
ロ: 'ろ',
ワ: 'わ',
ヲ: 'を',
ン: 'ん',
// ヴ: 'ゔ',
};

export enum KANA {
HIRAGANA_START = 0x3041,
HIRAGANA_END = 0x309f,
KATAKANA_START = 0x30a0,
KATAKANA_END = 0x30ff,
HW_KATAKANA_START = 0xff66,
HW_KATAKANA_END = 0xff9d,
}

export enum PUNCTUATION {
//characters below are in order for easy copy
//Note:3rd character is invisible but copyable
//Note:4th and 5th look the same but are actually different.
// ゙, ゚, ‌, ~, 〜
VOICED_MARK = 0xff9e,
SEMI_VOICED_MARK = 0xff9f,
ZERO_WIDTH_JOINER = 0x200c,
J_TILDE = 0xff5e,
HW_J_TILDE = 0x301c,
}
Loading