David L. Day > Lingua-AtD-1.121570 > Lingua::AtD::Error

Download:
Lingua-AtD-1.121570.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.121570   Source  

NAME ^

Lingua::AtD::Error - Encapsulates the grammar/spelling/style Errors contained in Results.

VERSION ^

version 1.121570

SYNOPSIS ^

    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";
    }

DESCRIPTION ^

Encapsulates the grammar/spelling/style Errors contained in Results.

METHODS ^

get_string

    $atd_error->get_string();

Returns the string in error.

get_description

    $atd_error->get_description();

Returns a string description of the error.

get_precontext

    $atd_error->get_precontext();

Returns a string. Usually the word or words immediately preceding the word or phrase in error.

has_suggestions

    $atd_error->has_suggestions();

Returns a boolean (1|0) indicating if the AtD service provided suggestions for fixing the error.

get_suggestions

    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.

get_type

    $atd_error->get_type();

Returns a string indicating the type of error. One of grammar, spelling, or style.

has_url

    $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.

get_url

    $atd_error->get_url();

Returns a url to the AtD service providing details on the error. This url is suitable for use in UIs.

METHODS ^

SEE ALSO ^

See the API Documentation at After the Deadline's website.

AUTHOR ^

David L. Day <dday376@gmail.com>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: