de.fh_mannheim.mm.dms.framework
Class StopwordManager

java.lang.Object
  extended byde.fh_mannheim.mm.dms.framework.StopwordManager
All Implemented Interfaces:
IElement, IProducer

public class StopwordManager
extends java.lang.Object
implements IProducer

This class organizes all stopwords.

Version:
$Revision: 1.4 $
Author:
Jan Löffler, mail@jlsoft.de

Constructor Summary
StopwordManager(Config cfg)
          Constructor.
 
Method Summary
 boolean addStopword(Stopword word)
          Add a new stopword.
 int addStopwordList(java.lang.String[] strWords, int nLanguage)
          Adds stopwords.
 boolean deleteStopword(java.lang.String strStopword)
          Delete stopword.
 boolean existsStopword(java.lang.String strStopword)
          Check if stopword exists.
 boolean exportStopwords(java.lang.String strFilename)
          Export stopwords to xml file.
 boolean exportStopwordsToTextfile(java.lang.String strFilename, int nLanguage)
          Save all stopwords in a textfile.
 StopwordList getAllStopwords()
          Get all names of stopwords.
 StopwordList getAllStopwords(int nLanguage)
          Get all names of stopwords.
 Stopword getStopword(java.lang.String strStopword)
          Get a stopword by name.
 int getStopwordNum()
          Count all stopwords.
 int importStopwords(java.lang.String strFilename)
          Import stopwords from xml file..
 int importStopwordsFromTextfile(java.lang.String strFilename, int nLanguage)
          Adds stopwords from a textfile.
 org.w3c.dom.Document produceReport()
          Generate xml document.
 org.w3c.dom.Element toElement(org.w3c.dom.Document doc)
          Write information of stopwords in a xml element.
 org.w3c.dom.Element toElement(org.w3c.dom.Element element, org.w3c.dom.Document doc)
          Write information of stopwords in a xml element.
 boolean updateStopword(Stopword editedStopword)
          Update an existing stopword.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.fh_mannheim.mm.dms.framework.IElement
toString
 

Constructor Detail

StopwordManager

public StopwordManager(Config cfg)
Constructor.

Parameters:
cfg - Config
Method Detail

addStopword

public boolean addStopword(Stopword word)
                    throws DuplicateStopwordException
Add a new stopword.

Parameters:
word - Stopword
Returns:
true, if successful
Throws:
DuplicateStopwordException

addStopwordList

public int addStopwordList(java.lang.String[] strWords,
                           int nLanguage)
Adds stopwords.

Parameters:
strWords - List with some stopwords
nLanguage - Language of stopwords
Returns:
number of added stopwords

deleteStopword

public boolean deleteStopword(java.lang.String strStopword)
Delete stopword.

Parameters:
strStopword - Stopword
Returns:
true, if successful

existsStopword

public boolean existsStopword(java.lang.String strStopword)
Check if stopword exists.

Parameters:
strStopword - Name of stopword
Returns:
true, if successful

exportStopwords

public boolean exportStopwords(java.lang.String strFilename)
                        throws java.io.IOException
Export stopwords to xml file.

Parameters:
strFilename - Filename of xml file
Returns:
true, if successful
Throws:
java.io.IOException - When file could not be saved

exportStopwordsToTextfile

public boolean exportStopwordsToTextfile(java.lang.String strFilename,
                                         int nLanguage)
                                  throws java.io.IOException
Save all stopwords in a textfile.

Parameters:
strFilename - Filename
nLanguage - Language of stopwords
Returns:
true, if successful
Throws:
java.io.IOException - When file could not be saved

getAllStopwords

public StopwordList getAllStopwords()
Get all names of stopwords.

Returns:
StopwordList with names

getAllStopwords

public StopwordList getAllStopwords(int nLanguage)
Get all names of stopwords.

Parameters:
nLanguage - Language of stopwords
Returns:
StopwordList with names

getStopword

public Stopword getStopword(java.lang.String strStopword)
Get a stopword by name.

Parameters:
strStopword - Name of stopword

getStopwordNum

public int getStopwordNum()
Count all stopwords.

Returns:
number of found stopwords

importStopwords

public int importStopwords(java.lang.String strFilename)
Import stopwords from xml file..

Parameters:
strFilename - Filename of xmlfile
Returns:
Number of imported stopwords

importStopwordsFromTextfile

public int importStopwordsFromTextfile(java.lang.String strFilename,
                                       int nLanguage)
Adds stopwords from a textfile.

Parameters:
strFilename - Filename of stopwordfile
nLanguage - Language of stopwords
Returns:
Number of imported stopwords

produceReport

public org.w3c.dom.Document produceReport()
Generate xml document.

Specified by:
produceReport in interface IProducer
Returns:
xml document

toElement

public org.w3c.dom.Element toElement(org.w3c.dom.Document doc)
Write information of stopwords in a xml element.

Specified by:
toElement in interface IElement
Parameters:
doc - XML Document
Returns:
element

toElement

public org.w3c.dom.Element toElement(org.w3c.dom.Element element,
                                     org.w3c.dom.Document doc)
Write information of stopwords in a xml element.

Specified by:
toElement in interface IElement
Parameters:
element - Root element
doc - XML Document
Returns:
element

updateStopword

public boolean updateStopword(Stopword editedStopword)
Update an existing stopword.

Parameters:
editedStopword - Stopword, which should be edited
Returns:
true, if successful