Category Archives: Tools for Writers

Finding doubled words using perl

I recently switched to Scrivener for writing my documents. Much more enjoyable interface than Word, with lots of nifty features for writers. One big issue: I’m still getting used to Scrivener’s spellchecker. Microsoft Word finds doubled words right out of the box, but Scrivener does not.

The script below is written in perl, which comes pre-installed on Macs. If you paste it into a text file, make the file executable, and then run it in the same directory with a file called “infile.txt” (a cut/paste from Word to the file will do nicely), it will report your doubled words.

*update* – the script won’t catch things like: “bang bang” because the quotes make it think it’s 2 patterns.  Working on it 🙂

Example input (infile.txt):

This is a line
This is another line
And yet another line
wow I sure do a lot of lines, "Don't I?" he said (in a funny voice)...
Wow it sure is is fune typing all this
I like dogs and cats and stuff.
Big big is funner than small people.
how are are the dodgers doing this year? Nobody knows.
more lines and stuff...
etc. etc.
good things come to those who write scripts in perl and post them on the internet

Example Output:

is is ---->  Wow it sure is is fune typing all this
big big ---->  Big big is funner than small people.
are are ---->  how are are the dodgers doing this year? Nobody knows.
etc. etc. ---->  etc. etc.

And now the script: rep.pl

#!/usr/bin/perl
open(FILE,"infile.txt") or die "Can't open infile.txt: $!";
$section_breaks = "*";  # I have * * * as section breaks. The script sees them as words and should ignore them.
while(<FILE>) {
   chomp();
   $a_line = $_;
   @line = split(/ /, $_);
   $prev = 0;   
   foreach $i (@line) {
      $i = lc($i);
      if ($i eq $prev && $i ne $section_breaks) {
         print "$prev $i ---->  $a_line\n";
      }
      $prev = $i;
   }
}
close(FILE);

10 Comments

Filed under Grammar/Punctuation, Tools for Writers, Writing in general

Need a good app to record stuff…

I came up with two cool phrases today but I only remember one of them: “corporate cute.”  Sounds like something already invented, but not yet a cliche so I’m still happy with it.

The other one was better.  I really need to carry around a tape device, or get an app that I can take notes with while driving, or right before bed, etc.  Anyone have a favorite app?

*Update*

Folks over on kboards.com are recommending “Evernote” and “Voice Talk”.  Also, apparently iPhones have a built-in notes functionality where you speak and it records it.

2 Comments

Filed under Tools for Writers

Goodreads Quiz

One of my brilliant, beautiful readers suggested I create a quiz on Goodreads for Kick, so I did.

The Quiz

2 Comments

Filed under Tools for Writers

Re-blog: writing in the cloud on a Chromebook

pthyltonP.T. Hylton, author of “Regulation 19”, has this to say about writing in the cloud on a Chromebook.  He also makes fun of Best Buy, which is fun and appropriate.

Leave a comment

Filed under Tools for Writers

My gift to writers everywhere: agent query letter template

Everyone knows Christmas is the time for sharing, giving, and also receiving. This year I’ve received so much. I published my first novel and to my surprise it’s been well received. I know if I have any hope to keep receiving in 2014 I need to “give back” sometimes.

The agent query letter template below is my gift to the writing community, which sometimes retweets me and/or clicks “like” on my blog posts and/or clicks “like” on my facebook posts.  To the writing community, I’d like to see a little more “and” and a little less “or.”  But whatever.  That’s just how you are, I guess.

Dear [Agent’s Name],

Recently, I read a book on how to write and sell “fiction” to make money. The book said if I wanna make the big bucks I need a “literary agent.”

[Agent’s Name]: that’s where you come in.

The book went on to say that many literary agents are just failed writers who try to get rich by latching onto the success of people who actually have talent.  Now, I know that sounds bad, and trust me, I don’t think the author of that book was talking about you personally. But it has to be true for some agents, doesn’t it?  And let’s just assume it’s true in your case and you have no talent. Is that such a bad thing? Why not take me on as a “client,” and we’ll ride the gravy train to riches and fame together? You don’t have to be a failure forever—and neither do I!

The title of my book is [Book Title].  We can change the title to anything, I don’t care. It’s the “contents” of a book that matter, right? [Book Title] is an action-packed, fast-paced, rip-roaring adventure/mystery that’s hilarious yet sometimes sad.  And yes, I can take out any sad parts if needed, no worries. I only threw them in to get more women to read the book.

Last but not least, I just want to assure you that I ran spell check on the book like 10 times using Microsoft Word.

Sincerely,

[Your Name]

[Your Phone Number]

p.s., I’m offering 1% commission for the first 10,000 copies sold, 5% if you somehow  sell 50,000, and 10% if we crack 100,000.  But if we get up to a million sold, we need to dial things back down to 5%.  It’s still a mint though, so relax.

2 Comments

Filed under Funny, Submission Tips, Tools for Writers

Thulsa Doom knows

It seems to me that the riddle of steel applies to writing.


We think, “oh we need a better cover” or “website” or some famous person to promote us, but in the end the power isn’t in the tool, it’s the hand that wields it.

2 Comments

Filed under Tools for Writers, Writing in general, Writing Market

Find unbalanced smart quotes in HTML using Perl

So I’m brushing up an HTML document so I can publish it on the Kindle and I’ve discovered lots of unbalanced smart quotes. Smart quotes are double quotes that face to the right or the left, rather than just straight up and down. In HTML, they are rendered as “ldquo” and “rdquo” with an ampersand in front of each and a trailing semi-colon. I wrote a little script to make sure that for every left side I had a right side, and print out the lines in which they do not match.

Here you go:

#!/usr/bin/perl

open(FILE,"./file.html") or die "Can't open file.html: $!\n";

while(<FILE>) {
   chomp();
   $line = "$_";

   $l = "ldquo";
   $r = "rdquo";   
   $lc = 0;
   $rc = 0;   

   $lc = () = $line =~ /$l/g;
   $rc = () = $line =~ /$r/g;

   print "Lc = $lc  Rc = $rc\n";
   if ($lc != $rc) {
      print "\n$line\n";
   }
}
close(FILE);

3 Comments

Filed under Grammar/Punctuation, Tools for Writers