Sunday, April 19, 2015

Sentence Segmentation

Getting a computer to figure out where English sentences begin and end hasn’t been perfectly solved. There are libraries that do it, but they all seem focused on getting incrementally closer to how humans handle rare, ambiguous, or grammatically incorrect cases (and publishing academic papers along the way).

As a small part of a fun side project that’s just getting started, I needed sentence breaking specifically for well-edited text. For example, if someone forgot to capitalize the start of their sentence, I’d rather just move on than try to compensate with something that could misfire on valid sentences but makes a great research paper.

Besides, the whole project is for fun, and writing this part sounded fun.

Sunday, April 12, 2015

JavaScript Inheritance Advice

It’s hard to find comprehensive advice online about doing class-based inheritance in JavaScript because everyone just gives their preferred solution. Here’s a rundown of what to do and what to fall back on if that’s not possible:

  • Use a language that supports class-based inheritance and compiles to JavaScript. That’ll eliminate a lot of other quirks, too.
  • If you can’t change languages, or you like those other quirks, the upcoming version of JavaScript supports class-based inheritance and compiles to the current version.
  • If you can’t add compilation to your build, use Object.create.
  • If you need to support a browser like IE8 that doesn’t have Object.create, use a library that provides inheritance or an Object.create substitute.
  • If you can’t add a library, polyfill Object.create.
  • If you can’t polyfill, write a helper that works like the polyfill.
  • If you can’t do any of that because you’re supporting IE8 and teammates don’t want you adding dependencies, polyfilling built-ins, or writing helpers that smell like language extensions, read on.

Sunday, December 21, 2014

The Tree

I helped out a bit when Katie taught English night classes for adults in Japan. This was my contribution to the “memory book” that was her goodbye gift to the students. It had a page or two of English writing from each student, as well as from Katie and myself:

Monday, December 15, 2014

Interviewing the Company

I claim no special insight into the broader issues. This is something that happened, though details have been changed, and that I’m often reminded of:

Monday, September 15, 2014

Installing NPM Command-Line Applications at the User Level on Ubuntu

Recently, I’ve started to see more command-line applications written in JavaScript and meant to run on Node.js. Here are some notes on my preferred way to install them.

Thursday, February 6, 2014

Refusing to Code Golf

I’ve found a new way to keep programming fun: refusing to code golf.

I’ve never cared for code golfing (writing a program in as few characters as you can). It seems similar to writing a novel without the letter “E.” It can be impressive, but I’d be more impressed if you had your priorities straight.

Monday, October 14, 2013

Random Group Assignments

This small script randomly assigns members to groups of (as much as possible) equal size. I wrote it for Katie’s weekend “coffee talks” where her students practice English with a native speaker.