[Add] Implement Transliterator class for kanji and okurigana analysis; update requirements and spec files

This commit is contained in:
misyaguziya
2025-09-15 05:33:30 +09:00
parent 0d121ecaad
commit d3c206fb26
6 changed files with 11 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ a = Analysis(
['src-python\\mainloop.py'],
pathex=[],
binaries=[],
datas=[('./fonts', 'fonts/'), ('.venv/Lib/site-packages/zeroconf', 'zeroconf/'), ('.venv/Lib/site-packages/openvr', 'openvr/'), ('.venv/Lib/site-packages/pykakasi', 'pykakasi/'), ('.venv/Lib/site-packages/faster_whisper', 'faster_whisper/'), ('.venv/Lib/site-packages/hf_xet', 'hf_xet/')],
datas=[('./fonts', 'fonts/'), ('.venv/Lib/site-packages/zeroconf', 'zeroconf/'), ('.venv/Lib/site-packages/openvr', 'openvr/'), ('.venv/Lib/site-packages/faster_whisper', 'faster_whisper/'), ('.venv/Lib/site-packages/hf_xet', 'hf_xet/')],
hiddenimports=[],
hookspath=[],
hooksconfig={},

View File

@@ -5,7 +5,7 @@ a = Analysis(
['src-python\\mainloop.py'],
pathex=[],
binaries=[],
datas=[('./fonts', 'fonts/'), ('.venv_cuda/Lib/site-packages/zeroconf', 'zeroconf/'), ('.venv_cuda/Lib/site-packages/openvr', 'openvr/'), ('.venv_cuda/Lib/site-packages/pykakasi', 'pykakasi/'), ('.venv_cuda/Lib/site-packages/faster_whisper', 'faster_whisper/'), ('.venv/Lib/site-packages/hf_xet', 'hf_xet/')],
datas=[('./fonts', 'fonts/'), ('.venv_cuda/Lib/site-packages/zeroconf', 'zeroconf/'), ('.venv_cuda/Lib/site-packages/openvr', 'openvr/'), ('.venv_cuda/Lib/site-packages/faster_whisper', 'faster_whisper/'), ('.venv/Lib/site-packages/hf_xet', 'hf_xet/')],
hiddenimports=[],
hookspath=[],
hooksconfig={},

View File

@@ -13,12 +13,14 @@ sentencepiece==0.2.0
openvr==1.26.701
pydub==0.25.1
psutil==5.9.8
pykakasi==2.3.0
pycaw==20240210
websockets==15.0.1
huggingface_hub==0.32.2
hf-xet==1.1.2
setuptools==80.8.0
SudachiPy==0.6.10
SudachiDict-core==20250825
SudachiDict-full==20250825
translators @ git+https://github.com/misyaguziya/translators@5.9.2.1
SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1
tinyoscquery @ git+https://github.com/cyberkitsune/tinyoscquery@0.1.3

View File

@@ -14,12 +14,14 @@ sentencepiece==0.2.0
openvr==1.26.701
pydub==0.25.1
psutil==5.9.8
pykakasi==2.3.0
pycaw==20240210
websockets==15.0.1
huggingface_hub==0.32.2
hf-xet==1.1.2
setuptools==80.8.0
SudachiPy==0.6.10
SudachiDict-core==20250825
SudachiDict-full==20250825
translators @ git+https://github.com/misyaguziya/translators@5.9.2.1
SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1
tinyoscquery @ git+https://github.com/cyberkitsune/tinyoscquery@0.1.3

View File

@@ -14,7 +14,6 @@ from typing import Callable
from packaging.version import parse
from flashtext import KeywordProcessor
from pykakasi import kakasi
from device_manager import device_manager
from config import config
@@ -28,6 +27,7 @@ from models.translation.translation_languages import translation_lang
from models.transcription.transcription_languages import transcription_lang
from models.translation.translation_utils import checkCTranslate2Weight, downloadCTranslate2Weight, downloadCTranslate2Tokenizer
from models.transcription.transcription_whisper import checkWhisperWeight, downloadWhisperWeight
from models.transliterate.transliterate_transliterator import Transliterator
from models.overlay.overlay import Overlay
from models.overlay.overlay_image import OverlayImage
from models.watchdog.watchdog import Watchdog
@@ -99,7 +99,7 @@ class Model:
self.overlay_image = OverlayImage(config.PATH_LOCAL)
self.mic_audio_queue = None
self.mic_mute_status = None
self.kks = kakasi()
self.transliterator = Transliterator()
self.watchdog = Watchdog(config.WATCHDOG_TIMEOUT, config.WATCHDOG_INTERVAL)
self.osc_handler = OSCHandler(config.OSC_IP_ADDRESS, config.OSC_PORT)
self.websocket_server = None
@@ -285,7 +285,7 @@ class Model:
if romaji:
keys_to_keep.add("hepburn")
data_list = self.kks.convert(message)
data_list = self.transliterator.analyze(message, use_macron=False)
filtered_list = [
{key: value for key, value in item.items() if key in keys_to_keep}
for item in data_list