Succinct Scrivener

Imagine my surprise, nay, my consternation, when without moving from his privacy, Bartleby in a singularly mild, firm voice, replied, I would prefer not to.
But in quite as clear a one came the previous reply, I would prefer not to.
I would prefer not to, said he.
I would prefer not to, he said, and gently disappeared behind the screen.
Why do you refuse? I would prefer not to.
I would prefer not to.
I would prefer not to.
Will you tell me, Bartleby, where you were born? I would prefer not to.
Will you tell me any thing about yourself? I would prefer not to.
At present I would prefer not to be a little reasonable, was his mildly cadaverous reply.
I would prefer not to quit you, he replied, gently emphasizing the not.
Now what sort of business would you like to engage in? Would you like to re-engage in copying for some one? No; I would prefer not to make any change.
Too much confinement, I cried, why you keep yourself confined all the time! I would prefer not to take a clerkship, he rejoined, as if to settle that little item at once.
No: at present I would prefer not to make any change at all.

Our assignment for Programming Ato Z this week was to use regular expressions in Java to transform or analyze a text. I immediately thought of Herman Melville’s Bartleby, the Scrivener and imagined it might be fun to extract all the instances of Bartleby’s assertion: “I would prefer not to…” The block quote above is the output from the following code:

import com.decontextualize.a2z.TextFilter;
import java.util.regex.*;
public class Bartleby3 extends TextFilter {
public static void main(String[] args) {
new Bartleby3().run();
}
private String contents = new String();
public void begin() {
println(“Starting Succinct Scrivener…”);
}
public void eachLine(String line) {
String tempString=line.replaceAll(“\”", “”);
contents += tempString + ” “;
}
public void end() {
String[] temp;
temp = contents.split(“\\.”);
for(int i =0; i <temp.length ; i++){
Pattern p = Pattern.compile(“[Ii] would prefer not “);
Matcher m = p.matcher(temp[i]);
if (m.find()) {
println((temp[i])+”.”);
}
}
}
}

Reply