Hi Mike,
On Mon, Aug 11, 2025 at 03:07:44PM +0000, Mike Gabriel wrote:
> Hi Guido,
> 
> I plan to upload a trixie-pu for presage based on the attached .debdiff.
> Could you test if this causes any regressions in Phosh? For me the attached
> .debdiff fixes crashing Lomiri sessions when presage usage is enabled in the
> OSK (and the presage DB file contains words with apostrophe that match the
> entered phrase).

I tested the version in sid (which AFAIKT contains the same change) and
didn't see any serious¹ regressions yet, so 👍.

Somewhat related: We have a data packager for Debian
(phosh-osk-data-package) which creates packages for presage data. Let me
know (or send a patch) if we should add any symlinks for lomiri.

Cheers,
 -- Guido

1) E.g. we're not normalizing e.g don't vs don`t correctly in the data which 
becomes visible now. 

> 
> 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
> 

> diff -Nru presage-0.9.1/debian/changelog presage-0.9.1/debian/changelog
> --- presage-0.9.1/debian/changelog    2023-10-12 15:24:57.000000000 +0200
> +++ presage-0.9.1/debian/changelog    2025-08-11 17:02:57.000000000 +0200
> @@ -1,3 +1,13 @@
> +presage (0.9.1-2.6+deb13u1) trixie; urgency=medium
> +
> +  * debian/patches:
> +    + Add allow-words-with-apostrophes-to-be-predicted.patch. Support 
> suggesting
> +      words containing apostrophes. Don't crash maliit-server / 
> lomiri-keyboard
> +      / lomiri when using /usr/lib/lomiri-keyboard/plugins/en/database_en.db
> +      presage DB. (Closes: #770831, LP:#1384800).
> +
> + -- Mike Gabriel <[email protected]>  Mon, 11 Aug 2025 17:02:57 +0200
> +
>  presage (0.9.1-2.6) unstable; urgency=medium
>  
>    * Non-maintainer upload.
> diff -Nru 
> presage-0.9.1/debian/patches/allow-words-with-apostrophes-to-be-predicted.patch
>  
> presage-0.9.1/debian/patches/allow-words-with-apostrophes-to-be-predicted.patch
> --- 
> presage-0.9.1/debian/patches/allow-words-with-apostrophes-to-be-predicted.patch
>    1970-01-01 01:00:00.000000000 +0100
> +++ 
> presage-0.9.1/debian/patches/allow-words-with-apostrophes-to-be-predicted.patch
>    2025-08-11 17:01:43.000000000 +0200
> @@ -0,0 +1,59 @@
> +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: Mike Gabriel <[email protected]>
> +Forwarded: https://sourceforge.net/p/presage/patches/2/
> +Bug-Ubuntu: https://launchpad.net/bugs/1384800
> +Comment:
> + Derived from an earlier patch version by Michael Sheldon
> + <[email protected]> (dropping libboost as
> + build requirement).
> +
> +
> +--- 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
> diff -Nru presage-0.9.1/debian/patches/fix-bug-776720.patch 
> presage-0.9.1/debian/patches/fix-bug-776720.patch
> --- presage-0.9.1/debian/patches/fix-bug-776720.patch 2022-11-27 
> 14:02:27.000000000 +0100
> +++ presage-0.9.1/debian/patches/fix-bug-776720.patch 1970-01-01 
> 01:00:00.000000000 +0100
> @@ -1,17 +0,0 @@
> -Fix bug #776720
> ---- a/apps/gtk/gprompter/Makefile.am
> -+++ b/apps/gtk/gprompter/Makefile.am
> -@@ -253,10 +253,10 @@
> - gprompter_CFLAGS =  $(GNOME_CFLAGS) $(GTHREAD_CFLAGS) $(GMODULE_CFLAGS) \
> -                     -I$(top_srcdir)/src/lib \
> -                     -I$(srcdir)/scintilla/include 
> --gprompter_LDADD =   $(GNOME_LIBS) $(GTHREAD_LIBS) $(GMODULE_LIBS) \
> --                    -lm \
> -+gprompter_LDADD =   libscintilla.la \
> -                     ../../../src/lib/libpresage.la \
> --                    libscintilla.la
> -+                    $(GNOME_LIBS) $(GTHREAD_LIBS) $(GMODULE_LIBS) \
> -+                    -lm
> - if USE_GCC
> - gprompter_LDADD +=  -lstdc++
> - endif
> diff -Nru presage-0.9.1/debian/patches/series 
> presage-0.9.1/debian/patches/series
> --- presage-0.9.1/debian/patches/series       2023-10-12 15:24:57.000000000 
> +0200
> +++ presage-0.9.1/debian/patches/series       2025-08-11 17:01:43.000000000 
> +0200
> @@ -4,3 +4,4 @@
>  sfos/docs-Install-css-too.patch
>  sfos/text2ngram-Add-and-to-separators.patch
>  sfos/text2ngram-Add-non-breaking-space-to-whitespace-chars.patch
> +allow-words-with-apostrophes-to-be-predicted.patch

Reply via email to