in reply to removing stopwords

#!/usr/bin/perl -w use strict; my @data = ( "Some lines of text", "I love my lines of text", "These a +re nice lines" ); my @stopwords = ( "lines" ); my @lessWords = (); my (@arr,@a); foreach my $word (@data) { push @arr,split(/ /,$word); } WORD: foreach my $a (@arr) { foreach my $stop (@stopwords) { next WORD if $a eq $stop; } push(@lessWords, $a); } print join( ' ', @lessWords ), "\n"; __OUTPUT__ Some of text I love my of text These are nice

Replies are listed 'Best First'.
Re^2: removing stopwords
by zulqernain (Novice) on Jun 01, 2005 at 23:08 UTC
    i used the same thing in my program and it does not remove the stopwords but when i run this origram it works fine. i have rechceked the contents of the arrays every thing is fine...i dont understand where is the probelm

      Then show us a piece of code that displays the problem, including sample data that causes the problem. So far, you haven't shown us code that works by itself, and you haven't given sample data.

      We've showed you how to do it. That means the problem is with your implementation. If we don't see it, we can't help you.