datapreparation.stopword
Class EnglishStopwords

java.lang.Object
  extended by datapreparation.stopword.EnglishStopwords
All Implemented Interfaces:
Stopwords

public class EnglishStopwords
extends java.lang.Object
implements Stopwords

A class that eliminates English stopwords from a document.

Author:
Kjell-Inge Skogstad and Trond Řivind Eriksen

Constructor Summary
EnglishStopwords()
          A constructor that loads the English stopwords file, and puts the words in a HashMap
 
Method Summary
 java.lang.String getEngDefaultName()
          A method that gets the textfile with English stopwords.
 boolean loadEng(java.lang.String filename)
          A method that loads a file of the most common English words, and puts them in the HashMap
 boolean loadEngFromURL(java.lang.String filename)
          A method that loads English stopwords from an URL.
 java.lang.String removeStopwords(java.lang.String sentence)
          Method that removes English stopwords.
 java.lang.String stringCat(java.lang.String string1, java.lang.String string2)
          A method that concatenates two strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnglishStopwords

public EnglishStopwords()
A constructor that loads the English stopwords file, and puts the words in a HashMap

Method Detail

getEngDefaultName

public java.lang.String getEngDefaultName()
A method that gets the textfile with English stopwords.

Returns:
The textfile with English stopwords.

loadEng

public boolean loadEng(java.lang.String filename)
A method that loads a file of the most common English words, and puts them in the HashMap

Parameters:
filename - the filename of the most common words in English
Returns:
Return true if load is ok, false otherwise

loadEngFromURL

public boolean loadEngFromURL(java.lang.String filename)
A method that loads English stopwords from an URL.

Parameters:
filename -
Returns:
boolean

stringCat

public java.lang.String stringCat(java.lang.String string1,
                                  java.lang.String string2)
A method that concatenates two strings.

Parameters:
string1 - The first string to be concatenated
string2 - The second string to be concatenated
Returns:
The concatenated string (string1+string2)

removeStopwords

public java.lang.String removeStopwords(java.lang.String sentence)
Method that removes English stopwords.

Specified by:
removeStopwords in interface Stopwords
Parameters:
sentence - The sentence that stopwords should be removed from.
Returns:
sentence The sentence, not containing any stopwords.