Lingua...amadoir(3pm)
π Lingua::GA::Gramadoir β the vibe β¨
okay bestie, so this is Lingua::GA::Gramadoir, a 3pm Perl module, and it's literally the whole brain behind An GramadΓ³ir β the open-source grammar + style checker for the Irish language π (iykyk, it's a whole legend in the low-resource NLP world).
πΈ 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 is where all the segmentation, spell checking, part-of-speech tagging, and grammar checking code lives β the exact same code that powers "An GramadΓ³ir", an open-source grammar and style checker you can use with vim, emacs, OpenOffice, or straight up 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 π
β like, genuinely doing the most for languages that big tech forgot about, periodt.
π¨ the way that this matters: the Perl code in here is generated automatically from a higher-level representation of the grammatical rules, so do not edit it directly. fr fr. If you wanna help improve the lexicon or the rule sets, download the developers' pack from the An GramadΓ³ir 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 β turn this off and the whole vibe check fails, no cap π.interface_language => ""β Specify the language of output messages (not necessarily the language of the text to be checked). With the default value,Locale::Maketextattempts 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 inputTEXTup into sentences and returns a reference to an array containing the sentences βοΈ.tokenize TEXTβ Splits the inputTEXTup 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 inputWORDand returns it with (XML-style) markup indicating all of its possible parts of speech π·οΈ.add_tags TEXTβ Takes the inputTEXTand returns a reference to an array of sentences with (XML-style) disambiguated part-of-speech tags. Does not do any grammatical rule checking. so close but not quite the full thing πxml_stream TEXTβ Takes the inputTEXTand 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. Usegrammatical_errors(which is basicallyxml_streamplus some whittling down) as an interface with other programs β that's the one you actually want, bestie π«Ά.grammatical_errors TEXTβ Returns the grammatical errors in the inputTEXTas 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 byLocale::Maketextπ.
π SEE ALSO π
- <http://borel.slu.edu/gramadoir/>
Locale::Maketextperl(1)
π BUGS π
okay so ngl, 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 β go read it, it's giving receipts.
π AUTHOR π
Kevin P. Scannell, <kscanne@gmail.com>. an icon, honestly π
π 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 π.
and that's the whole page, bestie π¦ β this was perl v5.32.0, dated 2021-01-09, straight from the Lingua::GA::Gramadoir(3pm) User Contributed Perl Documentation. slay, stay grammatical πβ¨
π¦ where this page comes from
- debian bookworm: liblingua-ga-gramadoir-perl 0.7-4.1
- ubuntu jammy: liblingua-ga-gramadoir-perl 0.7-4.1
- ubuntu noble: liblingua-ga-gramadoir-perl 0.7-4.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms