mash-playbook/docs/services/languagetool.md
Tiz 18e752f3f2
add Languagetool (#144)
* add etke.cc languagetool v6.3-0 to requierements

* add languagetool to setup

* add LanguageTool to group_vars

* fix container_additional_networks var name

* add docs

* just a small clarification in the doc

* Fix incorrect closing role-specific comment

* Fix typos and improve wording on LanguageTool docs page

* Upgrade LanguageTool (v6.3-0 -> v6.3-1)

* Switch from languagetool_container_additional_networks to languagetool_container_additional_networks_auto

This is a new addition in LanguageTool v6.3-1

* Do not enable Traefik labels conditionally based on languagetool_hostname

This may have been appropriate for other roles, for which the hostname is optional, but not here.

For LanguageTool, `languagetool_hostname` is required.

* Fix languagetool section alignment

* Update languagetool.md with better explanation about n-gram data

---------

Co-authored-by: sudo-Tiz <mathis.worksome@simplelogin.fr>
Co-authored-by: Slavi Pantaleev <slavi@devture.com>
2024-02-13 19:39:14 +02:00

3.5 KiB

LanguageTool

LanguageTool is an open source online grammar, style and spell checker. Installing it is powered by the etke.cc/roles/languagetool Ansible role and Erikvl87/docker-languagetool docker image.

Dependencies

This service requires the following other services:

Configuration

To enable this service, add the following configuration to your vars.yml file and re-run the installation process:

########################################################################
#                                                                      #
# languagetool                                                         #
#                                                                      #
########################################################################

languagetool_enabled: true

languagetool_hostname: mash.example.com
languagetool_path_prefix: /languagetool

########################################################################
#                                                                      #
# /languagetool                                                        #
#                                                                      #
########################################################################

In the example configuration above, we configure the service to be hosted at https://mash.example.com/languagetool.

You can remove the languagetool_path_prefix variable definition, to make it default to /, so that the service is served at https://mash.example.com/.

Enabling n-gram data

LanguageTool can make use of large n-gram data sets to detect errors with words that are often confused, like their and there. Learn more in Finding errors using n-gram data.

The n-gram data set is huge and thus not part of the LanguageTool installation. To make use of it with your own LanguageTool server, you may enable n-gram data and choose which languages to download n-gram data for.

For a list of languages for which the Ansible role supports downloading n-gram data, consult the languagetool_ngrams_langs variable in the default/main.yml file. Additional languages may be available. If the role doesn't have a download URL for them, consider redefining languagetool_ngrams_langs yourself with your own language-code to download URL mapping or submit a PR to the languagetool Ansible role.

languagetool_ngrams_enabled: true

# See `languagetool_ngrams_langs` for a list of language-codes
# that the Ansible role supports.
languagetool_ngrams_langs_enabled: ['fr', 'en']

Usage

After installing, you can test your instance by making requests to LanguageTool's HTTP API.

An example HTTP request can be made with curl: curl --data "language=en-US&text=a simple test" https://mash.example.com/languagetool/v2/check

See the list of software that supports LanguageTool as an add-on and set https://mash.example.com/languagetool/v2 as the LanguageTool server (assuming you've installed at the /languagetool path prefix).