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

add korean #787

Merged
merged 9 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,8 @@
"ext/js/language/ja/japanese-transforms.js",
"ext/js/language/ja/japanese-wanakana.js",
"ext/js/language/ja/japanese.js",
"ext/js/language/ko/korean-text-processors.js",
"ext/js/language/ko/korean-transforms.js",
"ext/js/language/la/latin-transforms.js",
"ext/js/language/language-descriptors.js",
"ext/js/language/language-transformer.js",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,4 @@ Yomitan uses several third-party libraries to function.
| yomitan-handlebars | 1.0.0 | MIT | n/a |
| parse5 | 7.1.2 | MIT | git://github.com/inikulin/parse5.git |
| wanakana | 5.3.1 | MIT | git+ssh://[email protected]/WaniKani/WanaKana.git |
| hangul.js | 0.2.6 | MIT | git+https://github.com/e-/Hangul.js.git |
18 changes: 18 additions & 0 deletions dev/lib/hangul-js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (C) 2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

export * as Hangul from 'hangul-js';
1 change: 1 addition & 0 deletions docs/dictionaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Be aware that non-English dictionaries generally contain fewer entries than thei
#### Other Languages

- [KTY](https://github.com/themoeway/kaikki-to-yomitan) - Wiktionaries in various languages converted to Yomitan format.
- [KRDICT/STDICT](https://github.com/Lyroxide/yomitan-ko-dic/releases) - Korean dictionaries for Yomitan.

#### EPWING Dictionaries

Expand Down
38 changes: 38 additions & 0 deletions ext/js/language/ko/korean-text-processors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {Hangul} from '../../../lib/hangul-js.js';

/** @type {import('language').TextProcessor<boolean>} */
export const disassembleHangul = {
name: 'Disassemble Hangul',
description: 'Disassemble Hangul characters into jamo.',
options: [true], // Could probably also be set to [false, true], but this way it is always on
process: (str) => {
return Hangul.disassemble(str, false).join('');
}
};

/** @type {import('language').TextProcessor<boolean>} */
export const reassembleHangul = {
name: 'Reassemble Hangul',
description: 'Reassemble Hangul characters from jamo.',
options: [true], // Could probably also be set to [false, true], but this way it is always on
process: (str) => {
return Hangul.assemble(str);
}
};
Loading