Lingua::GA::Gramadoir(3) Check the grammar of Irish language text

SYNOPSIS


use Lingua::GA::Gramadoir;
my $gr = new Lingua::GA::Gramadoir;
my $errors = $gr->grammatical_errors( $text );
foreach my $error (@$errors) {
# process $error appropriately
}

DESCRIPTION

This module contains the code for segmentation, spell checking, part-of-speech tagging, and grammar checking used by ``An Gramadoir'', an open-source grammar and style checker that can be used with vim, emacs, OpenOffice, or through a command-line interface. An Gramadoir 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 Gramadoir web site: <http://borel.slu.edu/gramadoir/>.

CONSTRUCTOR

new %PARAMS
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).

METHODS

get_sentences TEXT
Splits the input TEXT up into sentences and returns a reference to an array containing the sentences.
tokenize TEXT
Splits the input TEXT up into orthographic words and returns a reference to an array containing the words.
spell_check TEXT
Returns a reference to an array containing the misspelled words appearing in the input text.
all_possible_tags WORD
Takes the input WORD and returns it with (XML-style) markup indicating all of its possible parts of speech.
add_tags TEXT
Takes the input TEXT and returns a reference to an array of sentences with (XML-style) *disambiguated* part-of-speech tags. Does not do any grammatical rule checking.
xml_stream TEXT
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.
grammatical_errors TEXT
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.

BUGS

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.

AUTHOR

Kevin P. Scannell, <[email protected]>.

COPYRIGHT AND LICENSE

Copyright (C) 2004, 2005, 2007 Kevin P. Scannell

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.