Skip to content

Instantly share code, notes, and snippets.

@ssokolow
Created September 27, 2012 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssokolow/3793644 to your computer and use it in GitHub Desktop.
Save ssokolow/3793644 to your computer and use it in GitHub Desktop.
Parsing and writing notices/tweets using the #fic_rating hashtag

Regular Expressions for Parsing #fic_rating Tweets/Notices

Regex with named capture groups and inline mode-setting (should be compatible with Python, PHP, .NET/C#, and the PCRE library):

(?m)(?:^|\s)#fic_rating\s+(?P<rating>\d(?:\.\d)?)(?:\s*(?:/|of)\s*(?P<possible>\d))?\.?\s+(?P<description>.*)\s+?(?P<url>https?://\S*)(?:\s|$)

Regex without named capture groups but with inline mode-setting (should work in Java):

(?m)(?:^|\s)#fic_rating\s+(\d(?:\.\d)?)(?:\s*(?:/|of)\s*(\d))?\.?\s+(.*)\s+?(https?://\S*)(?:\s|$)

Regex with neither named capture groups nor inline mode-setting (should work in Perl 5.8 and Javascript):

(?:^|\s)#fic_rating\s+(\d(?:\.\d)?)(?:\s*(?:/|of)\s*(\d))?\.?\s+(.*)\s+?(https?://\S*)(?:\s|$)

Note: In Perl and Javascript, you'll want to use the "m" flag that, for other languages, I specified within the regex. Otherwise, it will miss every second line in certain forms of "one notice/tweet per line" data.

Cautions

  1. I'm using the first edition of O'Reilly's Regular Expression Pocket Reference, so it's possible that, since it was written, your favourite language gained support for named capture groups.

  2. I only had time to test these regexes in the Kodos regex debugger for Python and RegexPal for JavaScript.

  3. Make sure you handle malformed entries properly if you're automatically parsing a tag feed from a site like Identi.ca. The announcement of this reference itself contains #fic_rating but doesn't follow the format described by these regexes.

Format Reference for the #fic_rating Hashtag

Primary audience

Fanfiction readers and reviewers

Definition

A micro-review of a work of fanfiction intended to aid potential readers in finding new entertainment.

Usage

#fic_rating <rating> [details] <url>

Rating

A value from 1.0 through 5.0 in steps of 0.5

Recommended forms:
  • 4 of 5
  • 4/5
  • 4
Details

A sentence or two satisfying as many of the following criteria as possible:

  • Tells the reader which series is/are being used as a base. (eg. Mention a distinctive character/place name, job title, etc.)
  • Conveys why a reader would want to read this particular story. (Ideally, the core plot concept... but if that's common, the plot element you enjoyed most is a good candidate)
  • In the case of a poor rating, quickly details what's wrong with the story.

If you would like examples of how to accomplish this in 140 characters or less, please see my use of this format on Identi.ca.

Further Suggestions

Voluntary standardization of ratings also benefits readers. In my experience, the following interpretations of ratings tend to hold true:

  • 1.0: Literally unreadable
  • 2.0: So out-of-character it's painful.
  • 3.0: Ho-hum. Nothing bad, but nothing good either. (Boring)
  • 4.0: Good.
  • 5.0: Excellent.

I advise reserving half ratings for stories firmly on the borderline between two integer ratings or where one aspect deserves a high rating but another deserves a low one. (eg. A great story horribly in need of proofreading or a story that started out excellent and then got stale.)

Use of detail levels beyond half-ratings is advised against as it generally becomes difficult for the reviewer to accurately determine what rating a story deserves. (You'll end up either having inaccurate ratings or having to go back and re-tweet old ratings to correct the decimal portion to a more appropriate value relative to a new story you've found)

At the top end (5.0), ratings can be a little vague ("Excellent" vs. "Award-winning") but, after a lot of thought, the best solution I've come up with is simply to use awards or a shortlist to denote the handful of stories that are beyond excellent. To do otherwise tends to run into problems with how people interpret ratings.

Finally, if you have an account on a StatusNet-based service like Identi.ca on which you post notices using #fic_rating on a reasonably regular basis, you are invited to add "ficratings" (plural, no underscore) to the "Tags for yourself" field in your profile.

Related links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment