projects
/
jmdict-cli.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a71285e
)
HACK: If guessing English input, try Romaji input as well
fixes-2020
author
norly
<ny-git@enpas.org>
Thu, 2 Jul 2020 22:59:13 +0000
(
00:59
+0200)
committer
norly
<ny-git@enpas.org>
Fri, 3 Jul 2020 21:45:38 +0000
(23:45 +0200)
jmdict.cpp
patch
|
blob
|
history
diff --git
a/jmdict.cpp
b/jmdict.cpp
index efbb7057db281569907c3c2831d56ae1a253b51a..a85686fde90bfb61f9978ea51dcc2717c621209a 100644
(file)
--- a/
jmdict.cpp
+++ b/
jmdict.cpp
@@
-115,7
+115,7
@@
int showEntry(void*, int, char** value, char**) {
}
cout << endl;
}
cout << endl;
-
+
string sense;
db->exec(
sql::query("SELECT sense, gloss FROM gloss WHERE lang=%Q AND entry=%s "
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)
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)
}
int main(int argc, char** argv)
@@
-174,14
+175,18
@@
try {
}
string subject = argv[optind];
db.reset(new sql::db(DICTIONARY_PATH));
}
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);
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);
toJapanese(subject);
+ else {
+ fromRomaji(subject);
+ toJapanese(subject);
+ }
cout << entries << " match(es) found." << endl;
return EXIT_SUCCESS;
cout << entries << " match(es) found." << endl;
return EXIT_SUCCESS;