Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

funtion on array elements

by sarvan (Sexton)
on Sep 05, 2011 at 20:13 UTC ( #924292=perlquestion: print w/replies, xml ) Need Help??

sarvan has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I have a array with set of elements. I want to send all the array elements to a funtion called stop word removal and get the words back in to the same array after stop word removal. The funtion take word one by one and removes stop words and returns it.

I said i have a module which actually does stop word removal. My prob is on array. I need to get the element of array and remove stop words and then send back the element to the same position.

For eg my arr is @array. it should have the same elements after stop-word removal, but stop-words wont be there.

Replies are listed 'Best First'.
Re: funtion on array elements
by Corion (Patriarch) on Sep 05, 2011 at 20:23 UTC

    I would review my course material. It is highly unlikely that your teacher asks you something that has not been extensively covered in the lessons and the course material.

    Personally, I would look at Stemmers on CPAN, and at perlfunc for the grep and map functions.

Re: funtion on array elements
by davido (Cardinal) on Sep 05, 2011 at 20:25 UTC

    So each element of the array is one word? Lingua::EN::StopWords

    use strict; use warnings; use Lingua::EN::StopWords qw/%StopWords/; my @words = qw/ .......whatever words you're testing...... /; @words = grep { !StopWords{$_} } @words;

    All credit to the module's POD. There's also Lingua::StopWords::EN, if the first module doesn't work out for you.

    Update: But Corion is probably right. Ask the professor. ;)


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://924292]
Approved by JSchmitz
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2023-09-25 10:25 GMT
Find Nodes?
    Voting Booth?

    No recent polls found