org.jasen.core.engine
Class JasenTrainer

java.lang.Object
  extended byorg.jasen.core.engine.JasenTrainer

public class JasenTrainer
extends Object

Trains the Jasen Engine and builds the JasenMap from a ham corpus and a spam corpus.

Training (and/or re-training) should be done regularly as new types of spam messages begin to appear

Author:
Jason Polites

Constructor Summary
JasenTrainer()
           
 
Method Summary
 String getHamCorpusPath()
          Gets the local path to the folder containing the HAM corpus.
 JasenMap getMap()
          Gets the JasenMap object produced as a result of a training run
 MimeMessageParser getMimeParser()
          Gets the MIME parser to be used during training.
 String getSpamCorpusPath()
          Gets the local path to the folder containind the SPAM corpus.
 JasenMapStore getStore()
          Gets the store into which the map produced by the training run will be stored.
 String getStorePath()
          Gets the path to the local file system into which the final JasenMapStore will be saved.
 MimeMessageTokenizer getTokenizer()
          Gets the tokenizer that will be used during training.
 void init()
          Initialises the trainer
 boolean isLoad()
          Returns the value of the load option
 void setHamCorpusPath(String hamCorpusPath)
          Sets the local path to the folder containind the HAM corpus.
 void setLoad(boolean load)
          Sets the load value for the trainer.
 void setMimeParser(MimeMessageParser mimeParser)
          Sets the MIME parser to be used during training.
 void setSpamCorpusPath(String spamCorpusPath)
          Sets the local path to the folder containind the SPAM corpus.
 void setStore(JasenMapStore store)
          Sets the store into which the map produced by the training run will be stored.
 void setStorePath(String storePath)
          Sets the path to the local file system into which the final JasenMapStore will be saved.
 void setTokenizer(MimeMessageTokenizer tokenizer)
          Sets the tokenizer that will be used during training.
 void train()
          Trains the engine to produce the JasenMap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JasenTrainer

public JasenTrainer()
Method Detail

init

public void init()
          throws JasenException
Initialises the trainer

Throws:
JasenException

train

public void train()
           throws JasenException
Trains the engine to produce the JasenMap

Throws:
JasenException
See Also:
JasenMap

getHamCorpusPath

public String getHamCorpusPath()
Gets the local path to the folder containing the HAM corpus.

Returns:
Either an absolute or classpath-relative path to the folder as a String.

setHamCorpusPath

public void setHamCorpusPath(String hamCorpusPath)
Sets the local path to the folder containind the HAM corpus.

Parameters:
hamCorpusPath - Either an absolute or classpath-relative path to the folder as a String.

getMap

public JasenMap getMap()
Gets the JasenMap object produced as a result of a training run

Returns:
Returns the map.
See Also:
JasenMap

getMimeParser

public MimeMessageParser getMimeParser()
Gets the MIME parser to be used during training.

Returns:
Returns the mimeParser.

setMimeParser

public void setMimeParser(MimeMessageParser mimeParser)
Sets the MIME parser to be used during training.

Parameters:
mimeParser - The mimeParser to set.

getSpamCorpusPath

public String getSpamCorpusPath()
Gets the local path to the folder containind the SPAM corpus.

Returns:
Either an absolute or classpath-relative path to the folder as a String.

setSpamCorpusPath

public void setSpamCorpusPath(String spamCorpusPath)
Sets the local path to the folder containind the SPAM corpus.

Parameters:
spamCorpusPath - Either an absolute or classpath-relative path to the folder as a String.

getStore

public JasenMapStore getStore()
Gets the store into which the map produced by the training run will be stored.

Returns:
Returns the store.

setStore

public void setStore(JasenMapStore store)
Sets the store into which the map produced by the training run will be stored.

Parameters:
store - The store to set.

getTokenizer

public MimeMessageTokenizer getTokenizer()
Gets the tokenizer that will be used during training.

Returns:
Returns the tokenizer.

setTokenizer

public void setTokenizer(MimeMessageTokenizer tokenizer)
Sets the tokenizer that will be used during training.

Parameters:
tokenizer - The tokenizer to set.

isLoad

public boolean isLoad()
Returns the value of the load option

Returns:
True if the trainer was instructed to load a previously created map. False otherwise

setLoad

public void setLoad(boolean load)
Sets the load value for the trainer.

Parameters:
load - If true, the trainer will append data to an existing map. Otherwise a new map will be created

getStorePath

public String getStorePath()
Gets the path to the local file system into which the final JasenMapStore will be saved.

This is only relevant to the DiskMapStore class, however the trainer assumes this anyway.

Returns:
Either an absolute or classpath-relative path to the file as a String.

setStorePath

public void setStorePath(String storePath)
Sets the path to the local file system into which the final JasenMapStore will be saved.

This is only relevant to the DiskMapStore class, however the trainer assumes this anyway.

Parameters:
storePath - Either an absolute or classpath-relative path to the file as a String.