NAME

Lingua::FreeLing3::Utils - text processing utilities using FreeLing3 Perl inferface

VERSION

Version 0.03

SYNOPSIS

Calculate n-grams for a given text.

use Lingua::FreeLing3::Utils qw/ngrams ngrams_pp/;

# calculate bigrams
my $ngrams = ngrams({ n => 2 }, $text);

# pretty print bigrams
ngrams_pp($ngrams);

Calculate word analysis (all possible for each word)

use Lingua::FreeLing3::Utils qw/word_analysis/;

# calculate analysis
my $analysis = word_analysis($word);

# in fact, you can get for a list of words
my @analysis = word_analysis(@words);

# or for a text, and we'll calculate the list for you
my @analysis = word_analysis($text);

EXPORT

The following functions can be exported:

ngrams
ngrams_pp
word_analysis

FUNCTIONS

word_analysis

Compute all possible analysis for a specific word, list of words, or words from a text. You can pass an optional first argument (hash reference) with extra configuration.

@analysis = word_analysis( { l=>'pt' }, @words );

ngrams

Compute n-grams for a given input. The argument to this function is the text to process. You can optionally add a hash reference of options.

ngrams({n => 2, l => 'en'}, $text);

The following options are available:

-n

Set n (default: bigrams, n = 2).

-l

Select language (default: en).

-i 1|0

Case insensitive (default: off).

-t 1|0

Use <s> and </s> around sentences (default: on).

-a 1|0

Compute all i-grams with i from 1 to the specified n value (default: off).

ngrams_pp

Pretty print n-grams data in plain text.

AUTHOR

Nuno Carvalho, <smash at cpan.org>

BUGS

Please report any bugs or feature requests to bug-lingua-freeling3-utils at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Lingua-FreeLing3-Utils. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Lingua::FreeLing3::Utils

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Nuno Carvalho.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.