Skip to content

Even if you’re the right typer, couldn’t hurt to use Typerighter!

License

Notifications You must be signed in to change notification settings

CaliberAI/typerighter

 
 

Repository files navigation

Typerighter

The Typerighter checker service frontend

Typerighter is the server-side part of a service to check a document against a set of user-defined rules. It's designed to work like a spelling or grammar checker.

We use it at the Guardian to check content against our style guide. Max Walker, the subeditor who inspired the creation of Typerighter, has written an introduction here.

To understand our goals for the tool, see the vision document.

For setup, see the docs directory.

For an example of a Typerighter client (the part that presents the spellcheck-style interface to the user), see prosemirror-typerighter.

How it works: an overview

The Typerighter checker service ingests user-defined rules from a RuleResource. This is a Google sheet, but the interface could be fulfilled from an arbitrary source.

Each rule in the service corresponds to a Matcher that receives the document and passes back a list of RuleMatch. We have the following Matcher implementations:

  • RegexMatcher uses regular expressions
  • LanguageToolMatcher is powered by the LanguageTool project, and uses a combination of native LanguageTool rules and user-defined XML rules as its corpus

Matches contain the range that match applies to, a description of why the match has occurred, and any relevant suggestions – see the RuleMatch interface for the full description.

Implementation

Both the checker and management services are built in Scala with the Play framework. Data is currently stored in a Google Sheet.

Google credentials are fetched from SSM using AWS Credentials or Instance Role.

Integration

The prosemirror-typerighter plugin provides an integration for the Prosemirror rich text editor.

If you'd like to provide your own integration, this service will function as a standalone REST platform, but you'll need to use pan-domain-authentication to provide a valid auth cookie with your requests.

Upgrading LanguageTool

LanguageTool has default rules that we use, and as we upgrade LT, these could change underneath us.

There's a script to see if rules have changed as a result of an upgrade in ./script/js/compare-rule-xml.js.

About

Even if you’re the right typer, couldn’t hurt to use Typerighter!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 63.8%
  • TypeScript 24.1%
  • JavaScript 4.2%
  • Less 3.9%
  • HTML 2.7%
  • Shell 1.3%