Lingua::AtD::Error - Encapsulates the grammar/spelling/style Errors contained in Results.
version 1.160790
use Lingua::AtD; # Create a new service proxy my $atd = Lingua::AtD->new( { host => 'service.afterthedeadline.com', port => 80 throttle => 2, }); # Run spelling and grammar checks. Returns a Lingua::AtD::Response object. my $doc_check = $atd->check_document('Text to check.'); # Loop through reported document errors. foreach my $atd_error ($doc_check->get_errors()) { # Do something with... print "Error string: ", $atd_error->get_string(), "\n"; } # Run only grammar checks. Essentially the same as # check_document(), sans spell-check. my $grmr_check = $atd->check_grammar('Text to check.'); # Loop through reported document errors. foreach my $atd_error ($grmr_check->get_errors()) { # Do something with... print "Error string: ", $atd_error->get_string(), "\n"; } # Get statistics on a document. Returns a Lingua::AtD::Scores object. my $atd_scores = $atd->stats('Text to check.'); # Loop through reported document errors. foreach my $atd_metric ($atd_scores->get_metrics()) { # Do something with... print $atd_metric->get_type(), "/", $atd_metric->get_key(), " = ", $atd_metric->get_value(), "\n"; }
Encapsulates the grammar/spelling/style Errors contained in Results.
$atd_error->get_string();
Returns the string in error.
$atd_error->get_description();
Returns a string description of the error.
$atd_error->get_precontext();
Returns a string. Usually the word or words immediately preceding the word or phrase in error.
$atd_error->has_suggestions();
Returns a boolean (1|0) indicating if the AtD service provided suggestions for fixing the error.
my @suggestions = $atd_error->get_suggestions();
In some cases, such as spelling, the AtD service may suggest corrections in the form of an array of strings.
$atd_error->get_type();
Returns a string indicating the type of error. One of grammar, spelling, or style.
$atd_error->has_url();
Returns a boolean (1|0) indicating if the AtD service provided a URL with more details on the error. This url is suitable for use in UIs.
$atd_error->get_url();
Returns a url to the AtD service providing details on the error. This url is suitable for use in UIs.
See the API Documentation at After the Deadline's website.
David L. Day <dday376@gmail.com>
This software is copyright (c) 2011 by David L. Day.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Lingua::AtD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::AtD
CPAN shell
perl -MCPAN -e shell install Lingua::AtD
For more information on module installation, please visit the detailed CPAN module installation guide.