Skip to content

Commit

Permalink
Merge pull request #146 from dobey/drop-presage
Browse files Browse the repository at this point in the history
Remove text prediction feature for now
  • Loading branch information
dobey authored Mar 13, 2024
2 parents 0ea21b3 + 5401371 commit 9b64784
Show file tree
Hide file tree
Showing 68 changed files with 52 additions and 123,330 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
echo "deb [trusted=yes] http://archive.neon.kde.org/unstable focal main" >> /etc/apt/sources.list.d/neon.list
apt-get update
apt-get dist-upgrade --purge -y
apt-get -y install build-essential cmake doxygen gettext libanthy-dev libchewing3-dev libhunspell-dev libpinyin13-dev libpresage-dev maliit-framework-dev pkg-config qtbase5-dev qtdeclarative5-dev qtfeedback5-dev qtmultimedia5-dev qtquickcontrols2-5-dev presage
apt-get -y install build-essential cmake doxygen gettext libanthy-dev libchewing3-dev libhunspell-dev libpinyin13-dev maliit-framework-dev pkg-config qtbase5-dev qtdeclarative5-dev qtfeedback5-dev qtmultimedia5-dev qtquickcontrols2-5-dev
- name: Build
run: |
Expand Down
125 changes: 45 additions & 80 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.9)

project(maliit-keyboard VERSION 2.3.1)

option(enable-presage "Use presage to calculate word candidates (maliit-keyboard-plugin only)" ON)
option(enable-hunspell "Use hunspell for error correction (maliit-keyboard-plugin only)" ON)
option(enable-tests "Build tests" ON)

Expand Down Expand Up @@ -76,6 +75,8 @@ set(MALIIT_KEYBOARD_LIB_SOURCES
set(WESTERNSUPPORT_SOURCES
plugins/westernsupport/spellchecker.cpp
plugins/westernsupport/spellchecker.h
plugins/westernsupport/spellpredictworker.cpp
plugins/westernsupport/spellpredictworker.h
plugins/westernsupport/westernlanguagefeatures.cpp
plugins/westernsupport/westernlanguagefeatures.h
plugins/westernsupport/westernlanguagesplugin.cpp
Expand All @@ -96,24 +97,6 @@ set(maliit-keyboard-definitions HUNSPELL_DICT_PATH="${HUNSPELL_DICT_PATH}"
MALIIT_KEYBOARD_LANGUAGES_DIR="${CMAKE_INSTALL_PREFIX}/${MALIIT_KEYBOARD_LANGUAGES_DIR}")
set(maliit-keyboard-include-dirs)

if(enable-presage)
# Presage headers incompatible with C++17, which is default in newer GCC
set(CMAKE_CXX_STANDARD 14)
find_package(Presage REQUIRED)

if(Presage_FOUND)
list(APPEND maliit-keyboard-definitions HAVE_PRESAGE)
list(APPEND maliit-keyboard-libraries ${Presage_LIBRARIES})
list(APPEND maliit-keyboard-include-dirs ${Presage_INCLUDE_DIRS})

list(APPEND WESTERNSUPPORT_SOURCES
plugins/westernsupport/candidatescallback.cpp
plugins/westernsupport/candidatescallback.h
plugins/westernsupport/spellpredictworker.cpp
plugins/westernsupport/spellpredictworker.h)
endif()
endif()

if(enable-hunspell)
find_package(Hunspell REQUIRED)
list(APPEND maliit-keyboard-definitions HAVE_HUNSPELL)
Expand Down Expand Up @@ -203,7 +186,7 @@ target_link_libraries(westernsupport ${maliit-keyboard-libraries} Maliit::Plugin
target_include_directories(westernsupport PUBLIC src/lib/logic plugins/westernsupport ${maliit-keyboard-include-dirs})
target_compile_definitions(westernsupport PRIVATE ${maliit-keyboard-definitions})

function(language_plugin _language _full_language _ebook)
function(language_plugin _language _full_language)
# To support layout style variations such as en@dv we need to avoid using
# the @ character in variables, so split and replace it with _
set(_target ${_language})
Expand All @@ -214,10 +197,6 @@ function(language_plugin _language _full_language _ebook)
set(PLUGIN_SOURCES
plugins/${_language}/src/${_full_language}plugin.h
plugins/${_language}/src/${_full_language}plugin.json)
if(enable-presage)
add_ngram(TEXT plugins/${_language}/src/${_ebook} DATABASE database_${_language}.db)
list(APPEND PLUGIN_SOURCES database_${_language}.db)
endif()
add_library(${_target}plugin MODULE ${PLUGIN_SOURCES})
set_target_properties(${_target}plugin PROPERTIES OUTPUT_NAME ${_language}plugin)
target_link_libraries(${_target}plugin maliit-keyboard-common westernsupport)
Expand All @@ -228,10 +207,6 @@ endif()
DESTINATION ${MALIIT_KEYBOARD_LANGUAGES_DIR}/${_language})
install(TARGETS ${_target}plugin
LIBRARY DESTINATION ${MALIIT_KEYBOARD_LANGUAGES_DIR}/${_language})
if(enable-presage)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/database_${_language}.db
DESTINATION ${MALIIT_KEYBOARD_LANGUAGES_DIR}/${_language})
endif()
foreach(_file IN LISTS ARGN)
install(FILES plugins/${_language}/${_file}
DESTINATION ${MALIIT_KEYBOARD_LANGUAGES_DIR}/${_language})
Expand All @@ -240,7 +215,7 @@ endfunction()

function(abstract_language_plugin _language _full_language)
set(options ABSTRACT_LANGUAGE_PLUGIN)
set(oneValueArgs NGRAM_DATABASE PLUGIN_DIR LANGUAGE_FEATURES)
set(oneValueArgs PLUGIN_DIR LANGUAGE_FEATURES)
set(multiValueArgs SOURCES LIBRARIES INCLUDE_DIRS DEFINITIONS FILES DIRECTORY)
cmake_parse_arguments(abstract_language_plugin "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

Expand Down Expand Up @@ -279,10 +254,6 @@ function(abstract_language_plugin _language _full_language)
foreach(_s IN LISTS abstract_language_plugin_SOURCES)
list(APPEND PLUGIN_SOURCES plugins/${_plugindir}/src/${_s})
endforeach()
if(enable-presage AND (NOT ${abstract_language_plugin_NGRAM_DATABASE} EQUAL ""))
add_ngram(TEXT plugins/${_plugindir}/src/${abstract_language_plugin_NGRAM_DATABASE} DATABASE database_${_language}.db)
list(APPEND PLUGIN_SOURCES database_${_language}.db)
endif()
add_library(${_target}plugin MODULE ${PLUGIN_SOURCES})
set_target_properties(${_target}plugin PROPERTIES OUTPUT_NAME ${_language}plugin)
target_link_libraries(${_target}plugin Qt5::Core Maliit::Plugins maliit-keyboard-common ${abstract_language_plugin_LIBRARIES})
Expand All @@ -303,48 +274,44 @@ function(abstract_language_plugin _language _full_language)
install(DIRECTORY plugins/${_plugindir}/${_dir}
DESTINATION ${MALIIT_KEYBOARD_LANGUAGES_DIR}/${_language})
endforeach()
if(enable-presage AND (NOT ${abstract_language_plugin_NGRAM_DATABASE} EQUAL ""))
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/database_${_language}.db
DESTINATION ${MALIIT_KEYBOARD_LANGUAGES_DIR}/${_language})
endif()
endfunction()

language_plugin(ar arabic free_ebook.txt)
language_plugin(az azerbaijani free_ebook.txt)
language_plugin(be belarusian free_ebook.txt)
language_plugin(bg bulgarian free_ebook.txt)
language_plugin(bs bosnian free_ebook.txt)
language_plugin(ca catalan paulina_buxareu.txt src/overrides.csv)
language_plugin(cs czech free_ebook.txt)
language_plugin(da danish free_ebook.txt src/overrides.csv)
language_plugin(de german buddenbrooks.txt)
language_plugin(el greek grazia_deledda-christos_alexandridis.txt)
language_plugin(en english the_picture_of_dorian_gray.txt src/overrides.csv)
language_plugin(eo esperanto alicio_en_mirlando.txt)
language_plugin(es spanish el_quijote.txt)
language_plugin(fa persian free_ebook.txt qml/Keyboard_symbols_fa.qml)
language_plugin(fi finnish free_ebook.txt)
language_plugin(fr french les_trois_mousquetaires.txt src/overrides.csv)
language_plugin(gd gaelic teacsa.txt)
language_plugin(he hebrew free_ebook.txt src/overrides.csv)
language_plugin(hr croatian knjiga.txt)
language_plugin(hu hungarian free_ebook.txt)
language_plugin(is icelandic althingi_umraedur_2004_2005.txt)
language_plugin(it italian la_francia_dal_primo_impero.txt src/overrides.csv)
language_plugin(lt lithuanian free_ebook.txt)
language_plugin(lv latvian free_ebook.txt)
language_plugin(mk macedonian free_ebook.txt)
language_plugin(nb norwegian free_ebook.txt)
language_plugin(nl dutch free_ebook.txt src/overrides.csv)
language_plugin(pl polish ziemia_obiecana_tom_pierwszy_4.txt)
language_plugin(pt portuguese historias_sem_data.txt src/overrides.csv)
language_plugin(ro romanian amintiri_din_copilarie.txt)
language_plugin(ru russian free_ebook.txt)
language_plugin(sl slovenian free_ebook.txt)
language_plugin(sr serbian free_ebook.txt)
language_plugin(sv swedish free_ebook.txt src/overrides.csv)
language_plugin(tr turkish free_ebook.txt)
language_plugin(uk ukrainian free_ebook.txt)
language_plugin(ar arabic)
language_plugin(az azerbaijani)
language_plugin(be belarusian)
language_plugin(bg bulgarian)
language_plugin(bs bosnian)
language_plugin(ca catalan src/overrides.csv)
language_plugin(cs czech)
language_plugin(da danish src/overrides.csv)
language_plugin(de german)
language_plugin(el greek)
language_plugin(en english src/overrides.csv)
language_plugin(eo esperanto)
language_plugin(es spanish)
language_plugin(fa persian qml/Keyboard_symbols_fa.qml)
language_plugin(fi finnish)
language_plugin(fr french src/overrides.csv)
language_plugin(gd gaelic)
language_plugin(he hebrew src/overrides.csv)
language_plugin(hr croatian)
language_plugin(hu hungarian)
language_plugin(is icelandic)
language_plugin(it italian src/overrides.csv)
language_plugin(lt lithuanian)
language_plugin(lv latvian)
language_plugin(mk macedonian)
language_plugin(nb norwegian)
language_plugin(nl dutch src/overrides.csv)
language_plugin(pl polish)
language_plugin(pt portuguese src/overrides.csv)
language_plugin(ro romanian)
language_plugin(ru russian)
language_plugin(sl slovenian)
language_plugin(sr serbian)
language_plugin(sv swedish src/overrides.csv)
language_plugin(tr turkish)
language_plugin(uk ukrainian)

abstract_language_plugin(en@dv englishdvorak
FILES src/overrides.csv
Expand All @@ -365,13 +332,11 @@ elseif(Anthy_FOUND)
INCLUDE_DIRS ${Anthy_INCLUDE_DIRS}
DIRECTORY qml/keys)
endif()
if(enable-presage)
abstract_language_plugin(ko korean
NGRAM_DATABASE korean.txt
SOURCES database_ko.db
LIBRARIES westernsupport
DIRECTORY qml/keys)
endif()

abstract_language_plugin(ko korean
LIBRARIES westernsupport
DIRECTORY qml/keys)

if(Pinyin_FOUND)
abstract_language_plugin(zh-hans pinyin ABSTRACT_LANGUAGE_PLUGIN
PLUGIN_DIR pinyin
Expand Down
34 changes: 0 additions & 34 deletions cmake/FindPresage.cmake

This file was deleted.

Empty file removed plugins/ar/src/free_ebook.txt
Empty file.
2 changes: 0 additions & 2 deletions plugins/az/src/azerbaijaniplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "languageplugininterface.h"
#include "westernlanguagesplugin.h"

//#include <presage.h>

class AzerbaijaniPlugin : public WesternLanguagesPlugin
{
Q_OBJECT
Expand Down
Binary file removed plugins/az/src/database_az.db
Binary file not shown.
Loading

0 comments on commit 9b64784

Please sign in to comment.