Wednesday, November 6, 2013

Can Natural Language be Groovy?



Groovy is not just the mantra of Hippies from the 60s. It's also a jvm language, sometimes referred to as java++. Last nights presentation by Jim White, at the LAJUG was on Groovy, specifically as used to perform natural language processing (NLP), or computational linguistics (CL).

TheHackerCIO is only peripherally knowledgeable about groovy.

From what I saw of it, it seemed like java without a semicolon terminating a line.

But that is just the starting point. From there, they have added a number of features from other programming languages to make you a more productive programmer. It looks worth taking a more detailed look at. Because the speed of agile prototyping possible in the untyped world is so overwhelmingly fast by comparison to the java world, and anything I can get that would give me that edge, while building on the type safety and huge ecosystem of the java frameworks world, is something that bears further serious investigation.

Jim's claim is that Groovy affords the most productivity possible to the Java programmer while building on what he already knows. That's a pretty compelling sales job!

He pointed out the use of the traditional shebang from Unix, so that a groovy script can easily invoke the groovy shell thusly:

#!/usr/bin/env groovy

which, as java programmers know, could not be the first line of a java program, but which is fine in groovy, and allows direct unix command line invocation of a script without the need to set environment variables and then compiling and executing.

I always like to follow along with a presentation, so if you are doing likewise, you can install the GVM (Groovy enVironment Manager) with a curl command:

curl -s get.gvmtool.net | bash

followed by:

gvm install groovy

this will allow you to enter and run this simple shell program:

#!/usr/bin/env groovy
System.out.println("Hello, world")
which can just be chmod-ed and run from the command line.

Groovy, apparently, has lots of interesting features to munge data.

And the quotation of the presentation was:
"Most of the work in CL is in fricking around with formats!"
Which is why Jim found groovy so helpful in his Graduate work.

I learned about two operators in Groovy, pulled from other languages:

1. The spaceship operator: <==> [name derived from resembling Darth Vader's ship]
2. The Elvis operator:        ?:       [name derived from resembling Elvis' hair]

both named after various resemblances. But you'll need to follow the links if you want to know more, because I've run over the limit on this posting already.

I Remain,

TheHackerCIO

No comments:

Post a Comment