File: 1-basic.t

package info (click to toggle)
liblingua-stopwords-perl 0.09-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 156 kB
  • sloc: perl: 853; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use strict;
use Test::More tests => 8;

BEGIN {
	use_ok('Lingua::StopWords');
	use_ok('Lingua::StopWords::EN');
	use_ok('Lingua::StopWords::FR');
};

my $wordlist = Lingua::StopWords::getStopWords('en');

ok($wordlist->{me});
ok(!$wordlist->{moi});

my $wordlist3 = Lingua::StopWords::getStopWords('xx');
is($wordlist3, undef);

my $wordlist1 = Lingua::StopWords::getStopWords('fr');
my $wordlist2 = Lingua::StopWords::FR::getStopWords();
is_deeply($wordlist1, $wordlist2);

my $text = 'ceci est un texte avec des mots au hasard';
my @words = split / /, $text;
my $t = join ' ', grep { !$wordlist1->{$_} } @words;
is ($t, 'ceci texte mots hasard');