From 39b52702fe59f2887704bc8ed780da307ba239ec Mon Sep 17 00:00:00 2001 From: Flammie A Pirinen Date: Thu, 2 Jan 2025 15:25:00 +0100 Subject: [PATCH] [Template merge] emojis and speller fixes --- configure.ac | 1 + m4/giella-macros.m4 | 38 ++++++++++++++++++- src/fst/transcriptions/Makefile.am | 1 + .../transcriptor-emoji2text.lexc | 23 +++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/fst/transcriptions/transcriptor-emoji2text.lexc diff --git a/configure.ac b/configure.ac index bc8b607..da6a2ce 100644 --- a/configure.ac +++ b/configure.ac @@ -196,6 +196,7 @@ gt_ENABLE_TARGETS gt_USE_SHARED([common], [shared-mul], [giella-shared-mul]) AM_CONDITIONAL([HAVE_SHARED_COMMON], [test x$gt_SHARED_common != xfalse]) +gt_NEED_SHARED([mul], [shared-mul], [giella-shared-mul], [0.0.3]) # Locally used shares above this line diff --git a/m4/giella-macros.m4 b/m4/giella-macros.m4 index 708aa8b..6ad834b 100644 --- a/m4/giella-macros.m4 +++ b/m4/giella-macros.m4 @@ -88,7 +88,7 @@ AC_MSG_RESULT([$GIELLA_CORE]) ############################################################### ### This is the version of the Giella Core that we require. ### ### UPDATE AS NEEDED. -_giella_core_min_version=1.0.4 +_giella_core_min_version=1.0.7 # GIELLA_CORE/GTCORE env. variable, required by the infrastructure to find scripts: AC_ARG_VAR([GIELLA_CORE], [directory for the Giella infra core scripts and other required resources]) @@ -867,6 +867,16 @@ AS_IF([test x$enable_abbr = xyes -a x$enable_generators = xno], [AC_MSG_ERROR([You need to enable generators to build the abbr file])]) AM_CONDITIONAL([WANT_ABBR], [test "x$enable_abbr" != xno]) +# Enable emojis in various stuffs - default is 'no' (because slow) +AC_ARG_ENABLE([emoji], + [AS_HELP_STRING([--enable-emoji], + [enable emoji @<:@default=no@:>@])], + [enable_emoji=$enableval], + [enable_emoji=no]) +AS_IF([test x$enable_emoji = xyes -a x$enable_transcriptors = xno], + [AC_MSG_ERROR([You need to enable transcriptors to build emojis for spellers])]) +AM_CONDITIONAL([WANT_EMOJIS], [test "x$enable_emoji" != xno]) + # Enable building tokenisers - default is 'no' AC_ARG_ENABLE([tokenisers], [AS_HELP_STRING([--enable-tokenisers], @@ -957,6 +967,32 @@ AC_MSG_RESULT([$gt_SHARED_$1]) AC_ARG_VAR([gt_SHARED_$1], [directory for shared $1 data]) ]) # gt_USE_SHARED +################################################################################ +# Define function to require version for shared targets +################################################################################ +# Usage: gt_USE_SHARED(NAME, SHARED REPONAME, [PKG-CONFIG NAME], VERSION) +# where, NAME is used as the variable name: gt_SHARED_$NAME, and +# REPONAME is used as directory name and pkg-config name +# PKG-CONFIG NAME is pkg-config name of dependency if different from $2 +# VERSION is pkg-config atleast version spec + +AC_DEFUN([gt_NEED_SHARED],[ +gt_USE_SHARED([$1]) +THIS_TOP_SRC_DIR=$BUILD_DIR_PATH/$MYSRCDIR +_gt_shared_$1_min_version=$4 +_gt_pkg_name=m4_default([$3], [$2]) +AC_MSG_CHECKING([whether shared-$1 is at least $_gt_shared_$1_min_version]) +AS_IF([test -d "$THIS_TOP_SRC_DIR"/../$2], + [AS_IF([pkg-config --atleast-version=$_gt_shared_$1_min_version --with-path="$THIS_TOP_SRC_DIR/"../$2 $_gt_pkg_name], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([$2 needs to be updated, cd ../$1 and git pull and build])])], + [AS_IF([pkg-config --atleast-version=$_gt_shared_$1_min_version $_gt_pkg_name], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([$3 needs to be updated and installed])])]) +]) # gt_NEED_SHARED + ################################################################################ # Define function to print the configure footer ################################################################################ diff --git a/src/fst/transcriptions/Makefile.am b/src/fst/transcriptions/Makefile.am index 0a84db0..6e294da 100644 --- a/src/fst/transcriptions/Makefile.am +++ b/src/fst/transcriptions/Makefile.am @@ -26,6 +26,7 @@ GT_TRANSCRIPTIONS_SRCS=\ transcriptor-numbers-digit2text.lexc #! @param GT_ABBREV_SRCS required, for abbreviation expansions GT_ABBREV_SRCS=transcriptor-abbrevs2text.lexc +GT_EMOJIS_SRCS=transcriptor-emoji2text.lexc GT_TRANSCRIPTIONS_REGEX_SRCS= diff --git a/src/fst/transcriptions/transcriptor-emoji2text.lexc b/src/fst/transcriptions/transcriptor-emoji2text.lexc new file mode 100644 index 0000000..a8f2cdf --- /dev/null +++ b/src/fst/transcriptions/transcriptor-emoji2text.lexc @@ -0,0 +1,23 @@ +! Simple transcriptions from texts to emoji + +LEXICON Root + +🏠:talo # ; +🐈:kissa # ; +🐕:koira # ; +🏡:puutarha # ; +🧊:kylmä # ; +👦:poika # ; +👧:tyttö # ; +🪟:ikkuna # ; +🌲:puu # ; +🖐:käsi # ; +👁:silmä # ; +🧍:ihminen # ; +🪑:tuoli # ; +🔉:ääni # ; +🐦:lintu # ; +🦍:eläin # ; +🗣:pää # ; +💧:vesi # ; +