Skip to content

Commit

Permalink
Merge branch 'romaji' into new-features
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroHeavenVN committed Sep 24, 2024
2 parents e998f8c + adb43c0 commit 9680740
Show file tree
Hide file tree
Showing 16 changed files with 556 additions and 29 deletions.
85 changes: 83 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
"electron-store": "^10.0.0",
"electron-updater": "^6.2.1",
"i18next": "^23.7.6",
"kuroshiro": "^1.1.2",
"kuroshiro-analyzer-kuromoji": "^1.1.0",
"music-metadata": "^10.0.1",
"node-id3": "^0.2.6",
"node-vibrant": "^3.2.1-alpha.1",
Expand All @@ -111,7 +113,8 @@
"react-virtuoso": "^4.7.10",
"sharp": "^0.33.2",
"songlyrics": "^2.4.5",
"tailwind-merge": "^2.2.2"
"tailwind-merge": "^2.2.2",
"wanakana": "^5.3.1"
},
"devDependencies": {
"@electron-toolkit/eslint-config-prettier": "^2.0.0",
Expand Down
3 changes: 3 additions & 0 deletions src/@types/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ declare global {
interface LyricLine {
originalText: string | SyncedLyricsLineWord[]; // Original text of the lyric line
translatedTexts: TranslatedLyricLine[]; // Array of translations in different languages
romanizedLyrics: string | SyncedLyricsLineWord[];
start?: number; // Timing start (for synced lyrics only)
end?: number; // Timing end (for synced lyrics only)
isEnhancedSynced: boolean; // Indicates if the original text is enhanced synced lyrics
Expand All @@ -269,6 +270,8 @@ declare global {
interface LyricsData {
isSynced: boolean;
isTranslated: boolean;
isJapanese: boolean;
isRomanized: boolean;
parsedLyrics: LyricLine[]; // Array of original lyric lines (both synced and unsynced
unparsedLyrics: string;
offset?: number;
Expand Down
47 changes: 47 additions & 0 deletions src/@types/kuromoji-analyzer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Kuromoji based morphological analyzer for kuroshiro
*/

declare class KuromojiAnalyzer {
/**
* Constructor
* @param {Object} [options] JSON object which have key-value pairs settings
* @param {string} [options.dictPath] Path of the dictionary files
*/
constructor({ dictPath: string }: { dictPath?: string; } = {});

/**
* Initialize the analyzer
* @returns {Promise} Promise object represents the result of initialization
*/
init(): Promise<void>;

/**
* Parse the given string
* @param {string} str input string
* @returns {Promise} Promise object represents the result of parsing
* @example The result of parsing
* [{
* "surface_form": "黒白", // 表層形
* "pos": "名詞", // 品詞 (part of speech)
* "pos_detail_1": "一般", // 品詞細分類1
* "pos_detail_2": "*", // 品詞細分類2
* "pos_detail_3": "*", // 品詞細分類3
* "conjugated_type": "*", // 活用型
* "conjugated_form": "*", // 活用形
* "basic_form": "黒白", // 基本形
* "reading": "クロシロ", // 読み
* "pronunciation": "クロシロ", // 発音
* "verbose": { // Other properties
* "word_id": 413560,
* "word_type": "KNOWN",
* "word_position": 1
* }
* }]
*/
parse(str: string = ''): Promise<string>;
}

declare module 'kuroshiro-analyzer-kuromoji' {
export default KuromojiAnalyzer;
}
Loading

0 comments on commit 9680740

Please sign in to comment.