Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Text::Ispell 0.04

    Download button

    No screenshots available
    Downloads: 427  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.8/5)
    17 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    John Porter | More programs
    Perl Artistic License / FREE
    May 21st, 2008, 11:45 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Text::Ispell description

    A Perl module for encapsulating access to the Ispell program.

    Text::Ispell.pm is a Perl module for encapsulating access to the Ispell program.

    SYNOPSIS

    # Brief:
    use Text::Ispell;
    Text::Ispell::spellcheck( $string );
    # or
    use Text::Ispell qw( spellcheck ); # import the function
    spellcheck( $string );

    # Useful:
    use Text::Ispell qw( :all ); # import all symbols
    for my $r ( spellcheck( "hello hacking perl shrdlu 42" ) ) {
    print "$r->{'type'}: $r->{'term'}n";
    }


    Text::Ispell::spellcheck() takes one argument. It must be a string, and it should contain only printable characters. One allowable exception is a terminal newline, which will be chomped off anyway. The line is fed to a coprocess running ispell for analysis. The line is parsed on non-wordchars into a sequence of terms. By default, the set of wordchars is defined in ispell as letters, digits, and the apostrophe. In other words, the line is subjected the equivalent of

    split /[^a-zA-Z0-9']+/

    (ispell has a means to add characters to the default set, but currently Text::Ispell does not provide access to that feature.)

    The result of ispell's analysis of each term is a categorization of the term into one of six types: ok, root, miss, none, compound, and guess. Some of these carry additional information.

    Text::Ispell::spellcheck returns a list of objects, each corresponding to a term in the spellchecked string. Each object is a hash (hash-ref) with at least two entries: 'term' and 'type'. The former contains the term ispell is reporting on, and the latter is ispell's determination of that term's type (see above). For types 'ok' and 'none', that is all the information there is. For the type 'root', an additional hash entry is present: 'root'. Its value is the word which ispell identified in the dictionary as being the likely root of the current term. For the type 'miss', an additional hash entry is present: 'misses'. Its value is a string of words, comma-separated, which ispell identified as being "near-misses" of the current term, when scanning the dictionary.

    A quickie example:

    use Text::Ispell qw( spellcheck );
    Text::Ispell::allow_compounds(1);
    for my $r ( spellcheck( "hello hacking perl salmoning fruithammer shrdlu 42" ) ) {
    if ( $r->{'type'} eq 'ok' ) {
    # as in the case of 'hello'
    print "'$r->{'term'}' was found in the dictionary.n";
    }
    elsif ( $r->{'type'} eq 'root' ) {
    # as in the case of 'hacking'
    print "'$r->{'term'}' can be formed from root '$r->{'root'}'n";
    }
    elsif ( $r->{'type'} eq 'miss' ) {
    # as in the case of 'perl'
    print "'$r->{'term'}' was not found in the dictionary;n";
    print "Near misses: $r->{'misses'}n";
    }
    elsif ( $r->{'type'} eq 'guess' ) {
    # as in the case of 'salmoning'
    print "'$r->{'term'}' was not found in the dictionary;n";
    print "Root/affix Guesses: $r->{'guesses'}n";
    }
    elsif ( $r->{'type'} eq 'compound' ) {
    # as in the case of 'fruithammer'
    print "'$r->{'term'}' is a valid compound word.n";
    }
    elsif ( $r->{'type'} eq 'none' ) {
    # as in the case of 'shrdlu'
    print "No match for term '$r->{'term'}'n";
    }
    # and numbers are skipped entirely, as in the case of 42.
    }


    Requirements:

    · Perl



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    encapsulating access | Ispell class | Perl module | Ispell | encapsulating | access

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM