codesimian
Class Email

java.lang.Object
  extended by codesimian.Email

public class Email
extends java.lang.Object

part of a college class project. mostly useless


Field Summary
 java.lang.String body
          Exactly as given to the constructor.
 int bodyStarts
          index in textIndex[] the email body starts.
protected  NaturalLanguage nl
           
 double spamFraction
          Range 0.0 (not at all like spam) to 1.0 (worst spam ever).
 java.lang.String subject
          Exactly as given to the constructor.
 int[] textIndex
          Each unique word has a number
 int uniqueWords
          how many unique words could be in the values of textIndex[], even if some of those values are not in textIndex[].
 double weight
          Relatively how important this email is to figuring out what divides spam and nonspam.
 
Constructor Summary
Email(java.lang.String subject, java.lang.String body, double spamFraction, NaturalLanguage nl)
           
 
Method Summary
static Email[] getEmailsFromFile(java.lang.String fileName, NaturalLanguage useThisInEmailConstructors)
          The file must contain my own email input format:
$$$startNewEmail
$$$spam .87
$$$subject email subject here
$$$text non-subject text here
Put newlines wherever you want.
 void readAgain(NaturalLanguage nl)
           
 java.lang.String textIndexsToString()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

spamFraction

public double spamFraction
Range 0.0 (not at all like spam) to 1.0 (worst spam ever).


subject

public java.lang.String subject
Exactly as given to the constructor.


body

public java.lang.String body
Exactly as given to the constructor.


textIndex

public int[] textIndex
Each unique word has a number


uniqueWords

public int uniqueWords
how many unique words could be in the values of textIndex[], even if some of those values are not in textIndex[]. Useful to scale a floating point number to the range of possible words.


nl

protected NaturalLanguage nl

bodyStarts

public int bodyStarts
index in textIndex[] the email body starts. Before that is the subject.


weight

public double weight
Relatively how important this email is to figuring out what divides spam and nonspam. Any positive value.

Constructor Detail

Email

public Email(java.lang.String subject,
             java.lang.String body,
             double spamFraction,
             NaturalLanguage nl)
Method Detail

readAgain

public void readAgain(NaturalLanguage nl)

textIndexsToString

public java.lang.String textIndexsToString()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getEmailsFromFile

public static Email[] getEmailsFromFile(java.lang.String fileName,
                                        NaturalLanguage useThisInEmailConstructors)
The file must contain my own email input format:
$$$startNewEmail
$$$spam .87
$$$subject email subject here
$$$text non-subject text here
Put newlines wherever you want. Spam ranges 0.0 to 1.0.