SippyCup is a simple semantic parser, written in Python, created purely for didactic purposes.
Python Jupyter Notebook HTML
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
img Fixing bugs in figures May 2, 2016
.gitignore Ignore .ipynb_checkpoints/. Mar 27, 2015
LICENSE Initial commit Mar 2, 2015
README.md First publication of complete SippyCup codebase and codelab Apr 22, 2015
annotator.py Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
aol-travel-queries.txt First publication of complete SippyCup codebase and codelab Apr 22, 2015
arithmetic.py First publication of complete SippyCup codebase and codelab Apr 22, 2015
domain.py Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
example.py Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
experiment.py Bugfix for experiment.interact() May 12, 2016
geo880.py First publication of complete SippyCup codebase and codelab Apr 22, 2015
geobase.py Fix bug introduced by trying to achieve Python 2/3 compatibility May 13, 2016
geonames.py Py 2/3 compatibility, mostly with `six`-based imports May 9, 2016
geoquery.py First publication of complete SippyCup codebase and codelab Apr 22, 2015
graph_kb.py Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
homework.html Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
homework.ipynb Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
homework.py Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
learning.py Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
metrics.py First publication of complete SippyCup codebase and codelab Apr 22, 2015
parsing.py Py 2/3 compatibility, mostly with `six`-based imports May 9, 2016
scoring.py Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
sippycup-unit-0.ipynb Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
sippycup-unit-1.ipynb Added figures in Unit 1 May 2, 2016
sippycup-unit-2.ipynb Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
sippycup-unit-3.ipynb Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
travel.py Migrated SippyCup codebase from Python 2 to Python 3. Apr 10, 2016
travel_examples.py First publication of complete SippyCup codebase and codelab Apr 22, 2015
travel_examples_dev.py Added dev examples for travel domain Apr 26, 2015

README.md

SippyCup

Bill MacCartney
Spring 2015

SippyCup is a simple semantic parser, written in Python, created purely for didactic purposes. The design favors simplicity and readability over efficiency and performance. The goal is to make semantic parsing look easy!

SippyCup demonstrates an approach to semantic parsing based around:

  • a context-free grammar with semantic attachments,
  • a chart-parsing algorithm,
  • a linear, feature-based scoring function for ranking candidate parses,
  • learning of scoring parameters using stochastic gradient descent, and
  • limited forms of grammar induction.

We present applications of SippyCup to three different domains:

  • natural language arithmetic: "two times three plus four"
  • travel queries: "driving directions to williamsburg virginia"
  • geographical queries: "how many states border the largest state"

SippyCup was inspired by, and partly adapted from, the demonstration code published as a companion to Liang & Potts 2015, "Bringing machine learning and compositional semantics together". It was developed primarily for the benefit of students in Stanford's CS224U: Natural Language Understanding, and therefore contains exercises (without solutions) for use in the class. However, it should be of use to anyone interested in learning about semantic parsing. If you're new to Python, you might find this Python tutorial useful.

In addition to the Python source code, SippyCup includes a codelab on semantic parsing, published as a sequence of four IPython Notebooks:

  • Unit 0: Introduction to semantic parsing
  • Unit 1: Natural language arithmetic
  • Unit 2: Travel queries
  • Unit 3: Geography queries

SippyCup remains a work in progress, and you will find a number of TODOs throughout this notebook and the accompanying Python codebase. You will likely also find errors! You can help to contribute to SippyCup by sending corrections to the author or by sending a pull request to the SippyCup GitHub repository.