Control: severity -1 critical Control: affects -1 lomiri Control: affects -1 maliit-server
Hi,The issue of failing to suggest words containing apostrophes is more critical than it initially seems/seemed:
Aug 10 22:41:28 lomiri-surface maliit-server[11391]: [DatabaseConnector] Error executing SQL: 'SELECT count FROM _1_gram WHERE word = 'henry's';' on database: '/usr/lib/lomiri-keyboard/plugins/en/database_en.db' : near "s": syntax error Aug 10 22:41:28 lomiri-surface maliit-server[11391]: Qt has caught an exception thrown from an event handler. Throwing Aug 10 22:41:28 lomiri-surface maliit-server[11391]: exceptions from an event handler is not supported in Qt. Aug 10 22:41:28 lomiri-surface maliit-server[11391]: You must not let any exception whatsoever propagate through Qt code. Aug 10 22:41:28 lomiri-surface maliit-server[11391]: If that is not possible, in Qt 5 you must at least reimplement Aug 10 22:41:28 lomiri-surface maliit-server[11391]: QCoreApplication::notify() and catch all exceptions there. Aug 10 22:41:28 lomiri-surface maliit-server[11391]: terminate called after throwing an instance of 'SqliteDatabaseConnector::SqliteDatabaseConnectorException' Aug 10 22:41:28 lomiri-surface maliit-server[11391]: what(): near "s": syntax error
The above error log shows what happens when I have lomiri-keyboard set to en_US keyboard layout and type into e.g. lomiri-calendar-app (adding a Nextcloud calendar, typing into the URL field via OSK).
The whole lomiri session will crash after having typed the first character, presage wants to suggest henry's which is a phrase in lomiri-keyboard's database_en.db.
I have update the patch of this bug report with a version that avoids adding libboost as a build requirement.
I will soon NMU this patch to get this issue and the lomiri session crash effects resolved.
Mike -- mike gabriel aka sunweaver (Debian Developer) mobile: +49 (1520) 1976 148 landline: +49 (4351) 486 14 27 GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22 0782 9AF4 6B30 2577 1B31 mail: [email protected], http://sunweavers.net
Description: Allow words with apostrophes to be predicted Stop the tokenizer from splitting based on apostrophes and allow for the escaping of words containing apostrophes in the database connector. Author: Michael Sheldon <[email protected]> Forwarded: https://sourceforge.net/p/presage/patches/2/ Bug-Ubuntu: https://launchpad.net/bugs/1384800 --- a/src/lib/core/charsets.h +++ b/src/lib/core/charsets.h @@ -180,7 +180,6 @@ '$', '%', '&', - '\'', '(', ')', '*', --- a/src/lib/predictors/dbconnector/databaseConnector.cpp +++ b/src/lib/predictors/dbconnector/databaseConnector.cpp @@ -293,12 +293,17 @@ std::string DatabaseConnector::sanitizeString(const std::string str) const { - // TODO - // just return the string for the time being - // REVISIT - // TO BE DONE - // TBD - return str; + std::string sanitized = str; + const std::string search = "'"; + const std::string replace = "''"; + + // Escape single quotes + size_t pos = 0; + while ((pos = sanitized.find(search, pos)) != std::string::npos) { + sanitized.replace(pos, search.length(), replace); + pos += replace.length(); + } + return sanitized; } int DatabaseConnector::extractFirstInteger(const NgramTable& table) const --- a/src/tools/text2ngram.cpp +++ b/src/tools/text2ngram.cpp @@ -174,7 +174,7 @@ std::ifstream infile(argv[i]); ForwardTokenizer tokenizer(infile, " \f\n\r\t\v ", - "`~!@#$%^&*()_-+=\\|]}[{'\";:/?.>,<«»"); + "`~!@#$%^&*()_-+=\\|]}[{\";:/?.>,<«»"); tokenizer.lowercaseMode(lowercase); // take care of first N-1 tokens
pgphSOlqip7o_.pgp
Description: Digitale PGP-Signatur

