This module contains the code for segmentation, spell checking, part-of-speech tagging, and grammar checking used by "An Gramadóir", an open-source grammar and style checker that can be used with vim, emacs, OpenOffice, or through a command-line interface. An Gramadóir is intended as a platform for the development of sophisticated natural language processing tools for languages with limited computational resources.

The Perl code contained in this module is generated automatically from a higher-level representation of the grammatical rules and should not be edited directly. Anyone interested in helping improve the lexicon or the rule sets should download the developers' pack from the An Gramadóir web site: http://borel.slu.edu/gramadoir/.

Constructs an instance of the grammar checker and loads the lexicon into memory. It should only be called once. Options may be specified by passing a hash containing any of the following keys:

fix_spelling => 0

Suggest replacements for misspelled or unknown words.

use_ignore_file => 0

Read a file containing words to be ignored when checking spelling and grammar.

unigram_tagging => 1

Resolve ambiguous part of speech according to frequency. This should be set to false only for debugging purposes because the pattern matching for grammatical errors relies on complete disambiguation.

interface_language => ""

Specify the language of output messages (not necessarily the language of the text to be checked). With the default value, Locale::Maketext attempts to determine the correct language to use based on things like your environment variables.

input_encoding => 'ISO-8859-1'

Specify the encoding for all texts passed to one of the module's exported functions. There is no currently no way to change the encoding of the data returned by the exported functions (always encoded as perl strings).

Takes the input TEXT and returns it as well-formed XML (encoded as perl strings, not utf-8) with full grammatical markup. Error messages are not localized. This function should only be exported for debugging/development purposes. Use "grammatical_errors" (which is basically "xml_stream" plus some whittling down) as an interface with other programs.

Returns the grammatical errors in the input TEXT as a reference to an array, one error per element of the array, with each error given in a simple XML format usable by other applications. Error messages are localized according to locale settings as determined by Locale::Maketext.

The grammar checker does not attempt a full parse of the input sentences nor does it attempt to exploit any semantic information. There are, therefore, certain constructs that cannot be dealt with correctly. See http://borel.slu.edu/gramadoir/bugs.html for a detailed discussion and specific examples.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.