summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2020-07-03 00:59:13 +0200
committernorly <ny-git@enpas.org>2020-07-03 23:45:38 +0200
commit6bb24216f026e7f86d4016f36b15e5bcb7d0a442 (patch)
treeefe5f5cb3dffcaa375230c37546e89f4a44aee02
parenta71285e3792f3c7326f3503275128e5aac180896 (diff)
HACK: If guessing English input, try Romaji input as wellfixes-2020
-rw-r--r--jmdict.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/jmdict.cpp b/jmdict.cpp
index efbb705..a85686f 100644
--- a/jmdict.cpp
+++ b/jmdict.cpp
@@ -115,7 +115,7 @@ int showEntry(void*, int, char** value, char**) {
}
cout << endl;
-
+
string sense;
db->exec(
sql::query("SELECT sense, gloss FROM gloss WHERE lang=%Q AND entry=%s "
@@ -161,7 +161,8 @@ void guessLanguage(const std::string& subject) {
if (options::source == options::JAPANESE && !isUTF8)
options::source = options::JAPANESE_ROMAJI;
else if (options::source == options::UNKNOWN)
- options::source = isUTF8 ? options::JAPANESE : options::NOT_JAPANESE;
+ // options::source = isUTF8 ? options::JAPANESE : options::NOT_JAPANESE;
+ options::source = isUTF8 ? options::JAPANESE : options::UNKNOWN;
}
int main(int argc, char** argv)
@@ -174,14 +175,18 @@ try {
}
string subject = argv[optind];
db.reset(new sql::db(DICTIONARY_PATH));
-
+
guessLanguage(subject);
if (options::source == options::JAPANESE)
fromJapanese(subject);
else if (options::source == options::JAPANESE_ROMAJI)
fromRomaji(subject);
- else
+ else if (options::source == options::NOT_JAPANESE)
toJapanese(subject);
+ else {
+ fromRomaji(subject);
+ toJapanese(subject);
+ }
cout << entries << " match(es) found." << endl;
return EXIT_SUCCESS;