in reply to how to use Lingua-Stem-UniNE-0.06 in perl
The Synopsis section of the Lingua::Stem::UniNE docs seems fairly straight-forward. While I haven't tested the code below, I believe it should work as intended.
use strict; use warnings; use Lingua::Stem::UniNE; # For examining data structures, if/when needed use Data::Dumper; $| = 1; # To make display of data structures a little nicer $Data::Dumper::Deepcopy = 1; $Data::Dumper::Sortkeys = 1; # Replace with actual file my $infile = q{/path/to/data/file.txt}; my @stems; # Languages: # bg - Bulgarian # cs - Czech # de - German # fa - Persian my $stemmer = Lingua::Stem::UniNE->new( language => q{bg} ); { local $/; open my $inf, q{<}, $infile or die $!; my $text = <$inf>; close $inf; my @words = split /\W/, $text; @stems = $stemmer->stem( @words ); } print "The following stems were found:\n"; foreach my $str ( sort { $a cmp $b } @stems ) { print $str, qq{\n}; }
Hope that helps.
|
|---|