percyliang / sempre

Semantic Parser with Execution
Other
828 stars 301 forks source link

SEMPRE 2.4: Semantic Parsing with Execution

What is semantic parsing?

A semantic parser maps natural language utterances into an intermediate logical form, which is "executed" to produce a denotation that is useful for some task.

A simple arithmetic task:

A question answering task:

A virtual travel agent task:

By parsing utterances into logical forms, we obtain a rich representation that enables much deeper, context-aware understanding beyond the words. With the rise of natural language interfaces, semantic parsers are becoming increasingly more powerful and useful.

What is SEMPRE?

SEMPRE is a toolkit that makes it easy to develop semantic parsers for new tasks. The main paradigm is to learn a feature-rich discriminative semantic parser from a set of utterance-denotation pairs. One can also quickly prototype rule-based systems, learn from other forms of supervision, and combine any of the above.

If you use SEMPRE in your work, please cite:

@inproceedings{berant2013freebase,
  author = {J. Berant and A. Chou and R. Frostig and P. Liang},
  booktitle = {Empirical Methods in Natural Language Processing (EMNLP)},
  title = {Semantic Parsing on {F}reebase from Question-Answer Pairs},
  year = {2013},
}

SEMPRE has been used in the following papers:

Please refer to the project page for a more complete list.

Where do I go next?

Installation

Requirements

You must have the following already installed on your system.

Other dependencies will be downloaded as you need them. SEMPRE has been tested on Ubuntu Linux 12.04 and MacOS X. Your mileage will vary depending on how similar your system is.

Easy setup

  1. Clone the GitHub repository:

    git clone https://github.com/percyliang/sempre
  2. Download the minimal core dependencies (all dependencies will be placed in lib):

    ruby ./pull-dependencies core
  3. Compile the source code (this produces libsempre/sempre-core.jar):

    ant core

    If there is any issue during compilation, try deleting the directories lib and fig and rerunning ./pull-dependencies core

  4. Run an interactive shell:

    ruby ./run @mode=simple

    You should be able to type the following into the shell and get the answer (number 7):

    (execute (call + (number 3) (number 4)))

To go further, check out the tutorial and then the full documentation.

Virtuoso graph database

If you will be using natural language to query databases (e.g., Freebase), then you will also need to setup your own Virtuoso database (unless someone already has done this for you):

For Ubuntu, follow this:

sudo apt-get install -y automake gawk gperf libtool bison flex libssl-dev

# Clone the repository
./pull-dependencies virtuoso

# Make and install
cd virtuoso-opensource
./autogen.sh
./configure --prefix=$PWD/install
make
make install
cd ..

on OS/X you can install virtuoso using homebrew by following the instructions here

To have SEMPRE interact with Virtuoso, the required modules need to be compiled as follow:

./pull-dependencies core corenlp freebase
ant freebase

Contribute

To contribute code or resource to SEMPRE:

ChangeLog

Changes from SEMPRE 1.0 to SEMPRE 2.0:

Changes from SEMPRE 2.0 to SEMPRE 2.1:

Changes from SEMPRE 2.1 to SEMPRE 2.2:

Changes from SEMPRE 2.2 to SEMPRE 2.3:

Changes from SEMPRE 2.3 to SEMPRE 2.3.1:

Changes from SEMPRE 2.3.1 to SEMPRE 2.4: