Index
All Classes|All Packages
A
- addBigram(String, String) - Method in class MarkovChain
-
Adds a bigram to the Markov Chain dictionary.
B
- BADWORD_REGEX - Static variable in class TweetParser
-
Regular Expressions
C
- chain - Variable in class MarkovChain
- cleanWord(String) - Static method in class TweetParser
-
Do not modify this method.
- count(T) - Method in class ProbabilityDistribution
-
Counts the number of occurrences of an element in the ProbabilityDistribution
- csvFileToTrainingData(String, int) - Static method in class TweetParser
-
Given a path to a CSV file and the column from which to extract the tweet data, computes a training set.
- csvFileToTweets(String, int) - Static method in class TweetParser
-
Given the argument pathToCSVFile and the column that the tweets are in, use the extractColumn and a FileLineIterator to extract every tweet from the CSV.
E
- extractColumn(String, int) - Static method in class TweetParser
-
Given a String that represents a line extracted from a CSV file and an int that represents the column of the CSV file that we want to extract from, return the contents of that column from the String.
F
- FileLineIterator - Class in <Unnamed>
-
FileLineIterator provides a useful wrapper around Java's provided BufferedReader and provides practice with implementing an Iterator.
- FileLineIterator(String) - Constructor for class FileLineIterator
-
Creates a FileLineIterator for the file located at filePath.
- fixDistribution(List<String>) - Method in class MarkovChain
-
Modifies all ProbabilityDistributions to output words in the order specified
- fixDistribution(List<String>) - Method in class TwitterBot
-
Modifies all MarkovChains to output sentences in the order specified
- fixDistribution(List<String>, boolean) - Method in class MarkovChain
-
Modifies all ProbabilityDistributions to output words in the order specified
- fixPunctuation(char) - Method in class TwitterBot
-
A helper function to return the numerical index of the punctuation.
G
- generateTweet(int) - Method in class TwitterBot
-
Generates a tweet of a given length by using the populated MarkovChain.
- generateTweets(int, int) - Method in class TwitterBot
-
Generates a series of tweets using generateTweet().
- get(String) - Method in class MarkovChain
-
Returns the ProbabilityDistribution for a given token.
- getEntrySet() - Method in class ProbabilityDistribution
- getPunctuation() - Static method in class TweetParser
- getRecords() - Method in class ProbabilityDistribution
- getTotal() - Method in class ProbabilityDistribution
-
Total number of instances that have been added via record().
H
- hasNext() - Method in class FileLineIterator
-
Returns true if there are lines left to read in the file, and false otherwise.
- hasNext() - Method in class MarkovChain
-
This method should check if there is another word to retrieve from the Markov Chain based on the current word of our walk.
I
- index - Variable in class ListNumberGenerator
- index(T) - Method in class ProbabilityDistribution
-
returns the index of the element such that pick(index) will return the element
- isPunctuated(String) - Static method in class TwitterBot
-
A helper function to determine if a string ends in punctuation.
- isPunctuation(String) - Method in class TwitterBot
-
Returns true if the passed in string is punctuation.
K
- keySet() - Method in class ProbabilityDistribution
L
- list - Variable in class ListNumberGenerator
- ListNumberGenerator - Class in <Unnamed>
-
Produces deterministic numbers by iterating repeatedly over a list or array of integers argued in the constructors.
- ListNumberGenerator(Integer[]) - Constructor for class ListNumberGenerator
-
Creates a ListNumberGenerator which generates numbers based off of an array of possible integers.
- ListNumberGenerator(List<Integer>) - Constructor for class ListNumberGenerator
-
Creates a ListNumberGenerator which generates numbers based off of a list of possible integers.
M
- main(String[]) - Static method in class TwitterBot
-
Prints ten generated tweets to the console so you can see how your bot is performing!
- MarkovChain - Class in <Unnamed>
-
A Markov Chain is a data structure that tracks the frequency with which one value follows another value in sequence.
- MarkovChain() - Constructor for class MarkovChain
-
No need to write any constructors.
- MarkovChain(NumberGenerator) - Constructor for class MarkovChain
-
No need to write any constructors.
- MAX_TWEET_LENGTH - Static variable in class TwitterBot
- mc - Variable in class TwitterBot
N
- next() - Method in class FileLineIterator
-
Returns the next line from the file, or throws a NoSuchElementException if there are no more strings left to return (i.e.
- next() - Method in class ListNumberGenerator
-
Returns the next integer available in the list.
- next() - Method in class MarkovChain
-
Returns: either 1.
- next(int) - Method in class ListNumberGenerator
-
Returns the next integer available in the list that is less than the specified bound.
- next(int) - Method in interface NumberGenerator
-
Generates a number based of off a specified bound.
- next(int) - Method in class RandomNumberGenerator
-
Grabs another integer from the Random number generator that is between 0 and bound (inclusive).
- ng - Variable in class MarkovChain
- ng - Variable in class TwitterBot
- NumberGenerator - Interface in <Unnamed>
-
This simple interface produces numbers.
P
- parseAndCleanSentence(String) - Static method in class TweetParser
-
Splits a String representing a sentence into a sequence of words, filtering out any "bad" words from the sentence.
- parseAndCleanTweet(String) - Static method in class TweetParser
-
Processes a tweet in to a list of sentences, where each sentence is itself a (non-empty) list of cleaned words.
- PATH_TO_OUTPUT_TWEETS - Static variable in class TwitterBot
- PATH_TO_TWEETS - Static variable in class TwitterBot
-
This is a path to the CSV file containing the tweets.
- pick(int) - Method in class ProbabilityDistribution
-
Picks an instance of the ProbabilityDistribution non-randomly according to the provided index.
- pick(NumberGenerator) - Method in class ProbabilityDistribution
-
Picks an instance of the ProbabilityDistribution according to the provided NumberGenerator.
- ProbabilityDistribution<T extends Comparable<T>> - Class in <Unnamed>
-
This class represents a probability distribution over a type T as a map from T values to integers.
- ProbabilityDistribution() - Constructor for class ProbabilityDistribution
- PUNCS - Static variable in class TweetParser
-
Valid punctuation marks.
R
- r - Variable in class RandomNumberGenerator
- RandomNumberGenerator - Class in <Unnamed>
-
Produces random numbers using Java's Random class
- RandomNumberGenerator() - Constructor for class RandomNumberGenerator
-
Generates numbers completely randomly.
- RandomNumberGenerator(long) - Constructor for class RandomNumberGenerator
-
Generates numbers randomly based off of a specified seed.
- randomPunctuation() - Method in class TwitterBot
-
A helper function for providing a random punctuation String.
- record(T) - Method in class ProbabilityDistribution
-
Add an instance to the ProbabilityDistribution.
- records - Variable in class ProbabilityDistribution
- removeURLs(String) - Static method in class TweetParser
-
Do not modify this method
- replacePunctuation(String) - Static method in class TweetParser
-
Do not modify this method.
- reset() - Method in class MarkovChain
-
DO NOT EDIT THIS METHOD.
- reset(String) - Method in class MarkovChain
-
Given a starting String, sets up the Iterator functionality such that: (1) the Markov Chain will begin a walk at start.
S
- sentenceSplit(String) - Static method in class TweetParser
-
Do not modify this method.
- smallestUpperBound - Variable in class ListNumberGenerator
- startWords - Variable in class MarkovChain
T
- toString() - Method in class MarkovChain
-
Use this method to print out markov chains with words and probability distributions.
- toString() - Method in class ProbabilityDistribution
-
Print the probability distribution
- total - Variable in class ProbabilityDistribution
- train(Iterator<String>) - Method in class MarkovChain
-
Adds a sentence's training data to the MarkovChain frequency information.
- TWEET_COLUMN - Static variable in class TwitterBot
- TweetParser - Class in <Unnamed>
-
TweetParser.csvFileToTrainingData() takes in a CSV file that contains tweets and iterates through the file, one tweet at a time, removing parts of the tweets that would be bad inputs to MarkovChain (for example, a URL).
- TweetParser() - Constructor for class TweetParser
- TwitterBot - Class in <Unnamed>
-
This is the class where everything you've worked on thus far comes together! You can see that we've provided a path to a CSV file full of tweets and the column from which they can be extracted.
- TwitterBot(String, int) - Constructor for class TwitterBot
-
Given a column and a path to the csvFile, initializes the TwitterBot by training the MarkovChain with sentences sourced from that CSV file.
- TwitterBot(String, int, NumberGenerator) - Constructor for class TwitterBot
-
Given a column and a path to the csvFile, initializes the TwitterBot by training the MarkovChain with all the sentences obtained as training data from that CSV file.
U
- URL_REGEX - Static variable in class TweetParser
W
- writeStringsToFile(List<String>, String, boolean) - Method in class TwitterBot
-
Given a List of Strings, prints those Strings to a file (one String per line in the file).
- writeTweetsToFile(int, int, String, boolean) - Method in class TwitterBot
-
Generates tweets and writes them to a file.
All Classes|All Packages