在Perl中使用雪球杆

 2020-09-16 

Use of snowball stemmer in Perl

请尝试使用以下代码阻止文件内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env perl
use strict;
use warnings;
use Lingua::Stem::Snowball;

my $filename = 'input.txt';
open my $info, $filename or die"Could not open file '$filename' $!";

while (my $line = <$info>)

    {
    my $sent;
    chomp $line;
    my @words = qw($line);
    my $stemmer = Lingua::Stem::Snowball->new( lang => 'en' );
    $stemmer->stem_in_place( \\@words );
    open FILE,">>output.txt" or die $!;
    print FILE"stem_in_place\
"
;
    close FILE;
    }

这给了我错误:

"Can't locate loadable object for module Lingua::Stem::Snowball in
@INC (@INC contains: C:/Perl64/site/lib C:/Perl64/lib .) at
snowballTry.pl line 4. Compilation failed in require at
snowballTry.pl line 4. BEGIN failed--compilation aborted at
snowballTry.pl line 4."

请我需要做些什么?


由于您需要安装缺少的模块,因此请尝试:

1
cpan Lingua::Stem::Snowball

用cpan安装Lingua::Stem::Snowball模块,错误将神奇地消失...