# Project pack: LanguageTool @ 535904c

Facts about **LanguageTool** for an AI following the [BespokeAI handover guide](https://handoff.bespokeai.software/guide/v2.md). This pack is pinned to one version and never changes after publication.

> LanguageTool finds spelling, grammar and style mistakes in more than 30 languages. It runs as a small server that browser extensions, LibreOffice and other tools can talk to, so your writing can be checked without being sent to a third-party company. You can add your own rules in simple XML files.

## Version and source
- Repository: https://github.com/languagetool-org/languagetool
- Pinned commit: `535904c66ac73708eb6f21c69468459c622a33a5`. Use exactly this version.
- Fresh checkout: use the setup below in an empty folder. If you already have this exact source checked out, keep your branch and use the development command instead; do not clone again or reset local changes.
- Or download a zip: https://github.com/languagetool-org/languagetool/archive/535904c66ac73708eb6f21c69468459c622a33a5.zip
- Official docs: https://dev.languagetool.org
- Licence: **LGPL-2.1-only**. Free to use and change. If you share a changed version of the library itself, you must share those changes under the same licence. Using it privately has no extra obligations.

## Running the pinned source
- Fresh pinned-source setup (skip clone and checkout in an existing worktree):

  ```sh
  git clone https://github.com/languagetool-org/languagetool bespoke-languagetool
  cd bespoke-languagetool
  git checkout --detach 535904c66ac73708eb6f21c69468459c622a33a5
  # Prepare development requirements and local configuration first.
  ./build.sh languagetool-standalone package -DskipTests
  ```

The commands below are a starting point from the reviewed source. Prepare the listed tools, local configuration and companion services before starting the app. These instructions have not yet been validated in participant sessions.

### Separate trial of the current release
This tries an upstream release, which may differ from the pinned source above. It does not run your source changes. Use only sample data and a separate data directory or volume. Check the upstream documentation before running it.

  ```sh
  docker run -d --name languagetool -p 8010:8010 erikvl87/languagetool
  # then open http://localhost:8010/v2/check?language=en-US&text=This%20are%20wrong
  ```

- Needs: Docker for a trial, JDK 17+ and Maven for development
- Develop: `./build.sh languagetool-standalone package -DskipTests`
- Test: `mvn test -pl languagetool-core`
- Stack: java, xml (Maven, Java HTTP server). Difficulty for a non-developer with an AI: **moderate**. A large Java project, but the common customisation (new grammar rules and a personal dictionary) is plain XML and text files. Changing the engine requires Java and Maven.

## Customisation points (settings → extend → code)
- **disable-or-enable-rules** [settings]: Turn individual checks on or off. → `The extension options or the languagetool.properties file`
- **personal-dictionary** [settings]: Names and words that should never be flagged. → `The extension dictionary or the server's user word list`
- **new-rules** [extend]: Add your own style or grammar rules. → `grammar.xml of the language module (for example languagetool-language-modules/en/src/main/resources/org/languagetool/rules/en/grammar.xml)`
- **server-config** [extend]: Port, languages, cache and limits. → `languagetool-server config and command line options`
- **java-rules** [code]: New kinds of checks written in Java. → `languagetool-core and languagetool-language-modules`

## Must keep working
- Existing rule IDs, since users disable rules by ID.
- XML rule syntax. Test with the rule tester before committing.
- Server privacy. Don't log checked text.

## Staying updatable
Keep personal rules in your own XML files outside the source tree. Then updating LanguageTool is simply swapping the server.

## Data, costs and safety
- Personal data: **no**. Stored in: Rules and dictionaries are files. The server keeps no text after checking it. Text you check is processed by the server you point the extension at. Use your own server for private writing.
- Service: n-gram data (optional) (optional, free download): Better detection of confused words such as there and their.
- Service: Browser extension or LibreOffice add-on (optional, free): Check writing wherever you type.
- Anything you check is sent to the server you configure. Run your own for private text.
- Do not expose the server to the internet without limits and a reverse proxy.

---

# Customising LanguageTool

LanguageTool is a big Java project, but personalising it rarely needs Java. Rules live in XML, dictionaries in text files.

## How the code is laid out

| You want to change… | Look in |
|---|---|
| Core engine | languagetool-core/ |
| Language rules and dictionaries | languagetool-language-modules/<language>/ |
| HTTP server | languagetool-server/ |
| Standalone build | languagetool-standalone/ |
| Command line tool | languagetool-commandline/ |
| Office add-on | languagetool-office-extension/ |

## Use the gentlest change first

1. **Settings (no code):** which rules are on, your personal dictionary and the server options.
2. **Extend:** your own XML rules.
3. **Code:** Java rules and new language support.

## Recipes

- **New pattern rule:** add a `<rule>` with a `<pattern>` and `<message>` to the language's grammar.xml and test it with the rule tester web page.
- **Run a private server:** start the Docker image and set the extension's server address to it.

## Running and checking your changes

- Run your rule against sentences that should and should not match.
- `mvn test` in the module you changed.
- Check the server responds at `/v2/check` with the sample text.

## Pitfalls

- Rule XML errors can break startup. Validate before deploying.
- Language modules are large. Build only what you need.

---
Machine-readable: [bespoke.yaml](https://handoff.bespokeai.software/p/languagetool/535904c/r2/bespoke.yaml) · Hosting options: [hosting.md](https://handoff.bespokeai.software/p/languagetool/535904c/r2/hosting.md) · Agent skill: [SKILL.md](https://handoff.bespokeai.software/p/languagetool/535904c/r2/SKILL.md)
