-
Notifications
You must be signed in to change notification settings - Fork 2
dan-f/Markov-Text-Generator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Daniel Friedman, Fall 2011 I affirm that I have adhered to the Honor Code in this assignment. Written for CS151 (Data Structures) at Oberlin College. An implementation of a text generation algorithm, utilizing a Markov model based on character frequency. Usage: `Java FrequencyCounter <k> <M> <filename>` where: * k is the Markov order * M (optional) is the number of characters to print out * filename is the name of the input file Classes: * MyHashMap -- Implementation of a HashMap using separate chaining backed by LinkedLists. Used in TextGenerator to map substrings to their Markov objects. * Markov -- Represents a k-character substring of text, and the characters which follow in the original text (along with the frequency counts of the substring and its suffix characters). * FrequencyCounter -- (Test program) Counts the frequencies of k-length substrings of input text. * SuffixCounter -- Similar to FrequencyCounter, but also counts the suffixes for each k-length substring in the text. * TextGenerator -- the main class. Reads an input file, generating a MyHashMap which maps substrings to their Markov objects. It then constructs an output string (starting with the beginning input text), which chooses each character based on how likely it is to follow the previous k characters. A silly example: < dfriedma@univac >java TextGenerator 7 Shakespeare [Enter DUKE SENIOR Now, my co-mates and good in every thing. I would not change it. AMIENS Happy is your grace, That feelingly persuade me what I am.' Sweet are the uses of adversity, Which, like the toad, ugly and venomous, Wears yet a precious jewel in his head; And this our life exempt from public haunt Finds tongues in trees, books in the running brooks, Sermons in stones and blows upon my body, Even till I shrink with cold, I smile and say 'This is no flattery: these woods More free from peril than the envious court? Here feel we but the penalty of Adam, The seasons' difference, as the icy fang And churlish chiding of the winter's wind, Which, like the toad, ugly and venomous, Wears yet a precious jewel in his head; And this our life exempt from public haunt Finds tongues in trees, books in the running brooks, Sermons in stones and brothers in exile, Hath not old custom made this life more sweet Than that of painted pomp? Are not these are counsellors That feelingly persuade me what I am.' Sweet are the uses of adversity, Which, like the toad, ugly and venomous, Wears yet a precious jewel in his head; And this our life exempt from peri
About
A text generation algorithm based on a Markov model for the data structures class at Oberlin College, Fall 2011.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published