|< 1 2 >| | 12 Einträge, 2 Seiten |
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#!/usr/local/bin/perl -w use strict; use warnings; my $miniparDir = "home/sat/minipar"; my @dataArray; my $parsedMiniparOutput; my $searchWord; my %dependentWord; my @stopwords; my %is_stopwords; $searchWord = $ARGV[0]; open(OPENSTOPW,'stopwords.lst'); my $var = 0; while(<OPENSTOPW>){ chomp; push @stopwords, ($_); } foreach(@stopwords){ $is_stopwords{$_} = 1; } close(OPENSTOPW); open(OPENMY,'minipar.txt'); while(<OPENMY>){ ... my($firstWord,$relation, $secondWord)=split(/:/,$_); my($first,$firstPOS)=split(/\s/,$firstWord); my($secondPOS,$second)=split(/\t/,$secondWord); ... if($is_stopwords{$second}){ next; } my $entry = "$relation $firstPOS $second $secondPOS"; $dependentWord{$entry}++; } close(OPENMY); print %is_stopwords, "\n";
1 2 3 4 5 6 7
my $miniparDir = "home/sat/minipar"; my @dataArray; my $parsedMiniparOutput; my $searchWord; my %dependentWord; my @stopwords; my %is_stopwords;
1 2 3 4 5 6 7 8
$searchWord = $ARGV[0]; open(OPENSTOPW,'stopwords.lst'); my $var = 0; while(<OPENSTOPW>){ chomp; push @stopwords, ($_); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
foreach(@stopwords){ $is_stopwords{$_} = 1; } close(OPENSTOPW); open(OPENMY,'minipar.txt'); while(<OPENMY>){ ... my($firstWord,$relation, $secondWord)=split(/:/,$_); my($first,$firstPOS)=split(/\s/,$firstWord); my($secondPOS,$second)=split(/\t/,$secondWord); ... if($is_stopwords{$second}){ next; } my $entry = "$relation $firstPOS $second $secondPOS"; $dependentWord{$entry}++; } close(OPENMY); print %is_stopwords, "\n";
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 27 28 29 30 31 32 33 34 35 36 37
#!/usr/local/bin/perl -w use strict; use warnings; my $miniparDir = "home/sat/minipar"; my @dataArray; my $parsedMiniparOutput; my %dependentWord; my %is_stopwords; my $searchWord = $ARGV[0]; open(my $fh_stop,'<','stopwords.lst') or die $!; while(my $line = <$fh_stop>){ chomp $line; $is_stopwords{$line} = 1; } close $fh_stop; open(my $fh,'<','minipar.txt') or die $!; while(my $line = <$fh>){ ... my($firstWord,$relation, $secondWord)=split(/:/,$line); my($first,$firstPOS)=split(/\s/,$firstWord); my($secondPOS,$second)=split(/\t/,$secondWord); ... if($is_stopwords{$second}){ next; } my $entry = "$relation $firstPOS $second $secondPOS"; $dependentWord{$entry}++; } close($fh); print %is_stopwords, "\n";
if( exists $is_stopwords{$second} ) {
Taulmarill+2007-09-11 14:32:27--Das liegt daran, dass ein Hashkey in dem Moment, in dem man in anguckt, z.b. um zu schauen ob es ihn gibt, auch schon erstellt wird. Das ganze kann man mit der Funktion exists umgehen, also so:
Code: (dl )if( exists $is_stopwords{$second} ) {
print %is_stopwords,"\n"
1althoughngss
|< 1 2 >| | 12 Einträge, 2 Seiten |