Technology

Reminderer Grammar Parser is Done!


I finished the grammar parser for Reminderer app. Yay!

I uploaded and made it available on the web thanks to Google App Engine. You can see it in action here:

http://grammarparser.appspot.com/parser.jsp

(Unfortunately, you can’t embed it directly in WordPress, so you’ll have to click the link.)

You can say things like:

  • buy milk tomorrow 8pm
  • Pat’s birthday May 1 repeats yearly

Go ahead and take it for a test drive. Let me know if you find bugs!

Google App Engine

For those of you who don’t know what Google App Engine is, it’s basically a free Java server with some important limitations:

  • A request can’t spawn sub-threads and must stop after it sends a response.
  • You can’t use JAR files in your app (so you’re basically limited to the standard Java libraries).

There are two problems with adding the grammar parser to the App Engine. First, the App Engine doesn’t know about Android. Second, the App Engine project should always have the latest grammar parser.

While there are probably better solutions, here’s how I deployed the grammar parser in a span of about 2 hours:

  • Created a new branch in the git repo called App Engine. I’ll always merge from master tothis branch. This way the app engine branch can have the latest grammar parser and local changes.
  • Created mock implementations for Context and Resource, the two Android classes used by the grammar parser.

The interface is taken straight from the App Engine hello world example. The JSP is below.

Next up is the database and the alarm system.

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.frankandrobot.reminderer.parser.*" %>
<%@ page import="com.frankandrobot.reminderer.datastructures.*" %>
<%
String task = request.getParameter("task");
String rslt = ""; 
if (task != null && task.trim().length() != 0)
{
 ContextFreeGrammar grammar = new ContextFreeGrammar(new Context());
 rslt = grammar.parse(task).toString();
}
%>
<!DOCTYPE HTML>
<html>
<body>
<form name="task" action="parser.jsp" method="post">
Task: <input type="text" name="task" cols="120">
<input type="submit" value="Submit">
</form>
<%=rslt%>
</body>
</html>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s