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:
(+ 3 4)
7
A question answering task:
(place_of_birth barack_obama)
Honolulu
A virtual travel agent task:
(and (type flight) (destination montreal) (departure_date 2014.12.09))
(list ...)
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.
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.
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.
Clone the GitHub repository:
git clone https://github.com/percyliang/sempre
Download the minimal core dependencies (all dependencies will be placed in lib
):
ruby ./pull-dependencies core
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
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.
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
To contribute code or resource to SEMPRE:
develop
branch
of the upstream repository.Changes from SEMPRE 1.0 to SEMPRE 2.0:
Changes from SEMPRE 2.0 to SEMPRE 2.1:
tables
package for the paper Compositional semantic parsing on semi-structured tables (ACL 2015).overnight
package for the paper Building a semantic parser overnight (ACL 2015).Changes from SEMPRE 2.1 to SEMPRE 2.2:
Changes from SEMPRE 2.2 to SEMPRE 2.3:
interactive
package for the paper Naturalizing a programming language through interaction (ACL 2017).Changes from SEMPRE 2.3 to SEMPRE 2.3.1:
tables
module to resemble SEMPRE 2.1, effectively making it work again.Changes from SEMPRE 2.3.1 to SEMPRE 2.4:
cprune
package for the paper Macro Grammars and Holistic Triggering for Efficient Semantic Parsing (EMNLP 2017).