Lingua::AtD::Scores - Encapsulate conversion of XML from /stats call to Metric objects.
version 1.121570
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 conversion of the XML response from the AtD server into a list of spelling/grammar/style metric objects (Lingua::AtD::Metric).
# Possible, but not likely my $atd_scores = Lingua::AtD::Scores->new($xml_response); foreach my $atd_metric ($atd_scores->get_metrics()) { # Do something really fun... }
Lingua::AtD::Scores objects should only ever be created from a method calls to Lingua::AtD. However, if you have saved XML responses from prior calls to AtD, you can use this object to convert those responses into PERL objects. I won't stop you.
See the SYNOPSIS for typical usage.
Convenience method to see if the AtD server returned an error message.
Exception message from the server.
Convenience method to see if the XML response from AtD actually contained any metrics.
Returns the number of linguistic metrics generated by AtD.
Returns a list of linguistic metrics as Lingua::AtD::Metric objects. For details on what metrics are supplied, see the API Documentation.
Returns a string containing the raw XML response from the AtD service call.
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.