Class Madlib
java.lang.Object
madlibgeneration.Madlib
The core object that contains the source text file from which its MadlibBlanker and MadlibFiller can blank words in the document and fill in the blanks with user-determined words
- Author:
- Adam Barnett
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) TextAnnotaterConverts CoreNLP tags with clearer part of speech identifiers.(package private) StringThe original text with certain words deleted and replaced with text blocks containing their associated parts of speechprivate final MadlibBlankerUtility class used to remove words from the source file and produce a new file with the blanked madlib(package private) StringProduced from the blankedText using user-prompted replacement words to replace the deleted words / part of speech blocksprivate final MadlibFillerUtility class to fill in the blanked madlib with user-chosen words and write it to a new file.(package private) StringSource text for madlib creationThe parts of speech associated with the removed words during the blankingn process.Used to pair the annotation identifiers from CoreNLP to clearer parts of speech. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfillInMadlib(Queue<String> replacementWords, String outFilename) Primarily called by CLI to create a filled-in Madlib.private Stringprivate voidremoveMadlibifiables(String filepath, int skipper) Removes the skipper-th madlibifiable word with a part of speech in the posBlocks hashset.private voidsetAnnotatedText(String text) private voidsetBlankedText(String filepath) private voidsetOriginalText(String originalText)
-
Field Details
-
posMap
-
blanker
Utility class used to remove words from the source file and produce a new file with the blanked madlib -
filler
Utility class to fill in the blanked madlib with user-chosen words and write it to a new file. This is referred to as a filled madlib. -
annotatedText
TextAnnotater annotatedTextConverts CoreNLP tags with clearer part of speech identifiers. CoreNLP is a library that, in this program, is used to annotate each word with a "token" that contains the word and its associated part of speech -
originalText
String originalTextSource text for madlib creation -
blankedText
String blankedTextThe original text with certain words deleted and replaced with text blocks containing their associated parts of speech -
filledText
String filledTextProduced from the blankedText using user-prompted replacement words to replace the deleted words / part of speech blocks -
posList
-
-
Constructor Details
-
Madlib
public Madlib(String originalText, String blankedTextPath, int skipper) throws IOException, utility.exceptions.TextNotProcessedException - Throws:
IOExceptionutility.exceptions.TextNotProcessedException
-
-
Method Details
-
removeMadlibifiables
private void removeMadlibifiables(String filepath, int skipper) throws IOException, utility.exceptions.TextNotProcessedException Removes the skipper-th madlibifiable word with a part of speech in the posBlocks hashset. Madlibifiable word are tagged with parts of speech included in the posMap. Assigns the instance's posList returned by the helper method.- Parameters:
skipper- determines the frequency of madlib blanking (madlibification). Example: if skipper == 3, the method will clear every third madlibifiable word.- Throws:
IOExceptionutility.exceptions.TextNotProcessedException
-
fillInMadlib
public void fillInMadlib(Queue<String> replacementWords, String outFilename) throws IOException, utility.exceptions.TextNotProcessedException Primarily called by CLI to create a filled-in Madlib. Calls the instance's MadlibFiller to actually create and write to the file. Public method callable by CLI.- Throws:
IOExceptionutility.exceptions.TextNotProcessedException
-
setOriginalText
-
getOriginalText
-
setAnnotatedText
- Throws:
utility.exceptions.TextNotProcessedException
-
setBlankedText
private void setBlankedText(String filepath) throws IOException, utility.exceptions.TextNotProcessedException - Throws:
IOExceptionutility.exceptions.TextNotProcessedException
-
getPosList
-
getPosMap
-