clothespeg has asked for the wisdom of the Perl Monks concerning the following question:
n 500
v 1200
Thanks in advance :)open(S, "Lexicon.txt"); while($sa=<S>){ ($POS, $Lemma) = split('\t',$sa); $emotive{$Lemma}=$POS}; open(File, 'eng.txt'); while($text = <File>){ #this is some preprocessing for the text $text =~ s/\s+/ /g; $text =~ s/,/ ,/g; $text =~ s/æ/ æ/g; $text =~ s/\?/ !/g; #$text =~ tr/A-Z/a=z/; @words = split(' ', $text); for $word(@words){ if(exists $emotive{$word}){ print $word }}};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help Improve/troubleshoot Simple Lexicon Perl Code
by GrandFather (Saint) on Jul 10, 2019 at 06:11 UTC | |
|
Re: Help Improve/troubleshoot Simple Lexicon Perl Code
by choroba (Cardinal) on Jul 10, 2019 at 08:59 UTC | |
|
Re: Help Improve/troubleshoot Simple Lexicon Perl Code (updated)
by AnomalousMonk (Archbishop) on Jul 10, 2019 at 12:04 UTC |