Closed ProgramComputer closed 10 months ago
Hi @ProgramComputer, thank you for the pull request! I implemented the manually changes, here are the details:
$langDefs
, it was signaled in another issue (#113) and I wanted something more robust, so I changed the variable to a constant (#163). In the end the system works a bit like your proposal.See 3e1e82769303f04494362f6dea1c15209c81064aHave a great day!
@HugoFara
- For MeCab, I simply implemented your changes. See 887ac35.
https://github.com/HugoFara/lwt/commit/887ac35047af534d67f2a478eeb07058d0c2a07d is a UI fix. The cause of MeCab bug is on https://github.com/HugoFara/lwt/blob/b64cd6ae7ba8eca2537c57fb144f7f3a754a41aa/inc/session_utility.php#L4810 . Apply this patch
diff --git a/inc/session_utility.php b/inc/session_utility.php
index e69c18e3..f5275e53 100644
--- a/inc/session_utility.php
+++ b/inc/session_utility.php
@@ -4807,7 +4807,9 @@ function phonetic_reading($text, $lang)
{
global $tbpref;
// Many languages are already phonetic
- if (!str_starts_with($lang, "ja") && !str_starts_with($lang, "jp")) {
+ $mecab = get_first_value('select LgRegexpWordCharacters as value from ' . $tbpref . 'languages where LgName = ' . '"Japanese"');
+
+ if (!str_starts_with($lang, "ja") && !str_starts_with($lang, "jp") && $mecab != "mecab") {
return $text;
}
That makes sense, actually I may create a new function phoneticReading($text, $lg_id)
, it will be better. I that case I will bundle it in the next minor release.
@HugoFara
That makes sense, actually I may create a new function
phoneticReading($text, $lg_id)
, it will be better. I that case I will bundle it in the next minor release.
Lg_ID can work after seeing https://github.com/HugoFara/lwt/issues/103#issuecomment-1499924588 for Mecab to be enabled independent of language.
I added a new parameter word_parsing
(on LWT_DATA.language
). That should be a more flexible way to address the issue. For now I don't want to touch the TTS feature any more since it already underwent a massive change with #153, and I don't see bugs for now...
Bug not fixed yet, opened #182.
Even when mecab was not set for Japanese; it would require it installed. Also changed phonetic reading to take LanguageName as that is the key used in the language table and not the language code.