Language Tool style grammar handling with spaCy

This packages leverages the Matcher API in spaCy to quickly match on spaCy tokens not dissimilar to regex. It reads a grammar.yml file to load up custom patterns and returns the results inside Doc, Span, and Token. It is extensible through adding rules to grammar.yml (though currently only the simple string matching is implemented).


import spacy from spacy_grammar.grammar import Grammar nlp = spacy.load('en') grammar = Grammar(nlp) nlp.add_pipe(grammar) doc = nlp('I can haz cheeseburger.') doc._.has_grammar_error # True
Author info

Motoki Wu


Categories pipeline

Submit your project

If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the project idea label on the issue tracker.

Read the docsJSON source