Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: removing stopwords from a word list

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default removing stopwords from a word list

    hi,

    i have a word list from which i need to remove stopwords.. i have a stopword list stroed in array a. im reading the array and then checking it with my word list... my word list contains elements as follws..

    it
    Belgium
    's IMEC
    a threeyear collaboration agreement
    all
    advanced metallization process

    i want to remove words like it, all from this list... but my code does not recognise it and all.. it recognises only the all in "advanced metallization process" word. i want to remove only the pronouns that are as a whole in the list. here is my code..pls help..

    for(Iterator f = words1.iterator();f.hasNext();){
                                String anew = f.next().toString();
                                System.out.println(anew);
                                for(int iFilt = 0; iFilt<a.length; iFilt++) {
                                    System.out.println("checking for " + a[iFilt]);
                                    if(anew.indexOf(a[iFilt]) != -1){
     
                                        System.out.println(a[iFilt]+""+"found!"+"in"+anew);
                                        anew = anew.replace(a[iFilt],"");
     
                               }
     
                               }
    }


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: removing stopwords from a word list

    Hello jessie,

    Welcome to the Java Programming Forums

    I have moved this thread to - File I/O & Other I/O Streams - Java Programming Forums

    There are several things you could try. How about splitting the line String into individual words? You could use space as a delimiter.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. Removing the middle cell
    By Shyamz1 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 7th, 2010, 12:35 PM
  2. Word filter assignment help
    By normandygahn in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 15th, 2010, 07:42 AM
  3. [SOLVED] Word Scramble Using Objects & Methods
    By Whitechapel in forum Object Oriented Programming
    Replies: 3
    Last Post: May 23rd, 2010, 12:38 PM
  4. How to invert a word String
    By Truffy in forum Java Programming Tutorials
    Replies: 16
    Last Post: October 3rd, 2009, 02:44 AM
  5. [SOLVED] Enhancement in program of removing whitespace from text file
    By John in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: April 27th, 2009, 09:36 AM