Skip to content

Commit e09c05e

Browse files
authored
Merge pull request #134 from sidaw/master
interactive learning
2 parents ff12965 + 144f15c commit e09c05e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+7502
-54
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,11 @@ java.hprof.txt
3636
/x
3737
scr
3838
rdf
39+
40+
# interactive outputs
41+
int-output*
42+
int-backup
43+
interactive/.ipynb_checkpoints
44+
# Community server logs
45+
community-server/data
46+
community-server/data-backup

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SEMPRE 2.1: Semantic Parsing with Execution
1+
# SEMPRE 2.2: Semantic Parsing with Execution
22

33
## What is semantic parsing?
44

@@ -106,7 +106,7 @@ similar your system is.
106106
./run @mode=simple
107107

108108
You should be able to type the following into the shell and get the answer `(number 7)`:
109-
109+
110110
(execute (call + (number 3) (number 4)))
111111

112112
To go further, check out the [tutorial](TUTORIAL.md) and then the [full
@@ -133,7 +133,7 @@ For Ubuntu, follow this:
133133
make install
134134
cd ..
135135

136-
on OS/X you can install virtuoso using homebrew by following the instructions
136+
on OS/X you can install virtuoso using homebrew by following the instructions
137137
[here](http://carsten.io/virtuoso-os-on-mac-os/)
138138

139139
To have SEMPRE interact with Virtuoso, the required modules need to be compiled as follow:
@@ -166,3 +166,7 @@ Changes from SEMPRE 2.0 to SEMPRE 2.1:
166166

167167
- Added the `tables` package for the paper *Compositional semantic parsing on semi-structured tables* (ACL 2015).
168168
- Add and `overnight` package for the paper *Building a semantic parser overnight* (ACL 2015).
169+
170+
Changes from SEMPRE 2.1 to SEMPRE 2.2:
171+
172+
- Added the `interactive` package for the paper *Naturalizing a programming language through interaction* (ACL 2017).

build.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@
8888
<jar destfile="${libsempre}/sempre-overnight.jar" basedir="${classes}/overnight"/>
8989
</target>
9090

91+
<!-- Compile interactive -->
92+
<target name="interactive" depends="init,core">
93+
<echo message="Compiling ${ant.project.name}: interactive"/>
94+
<mkdir dir="${classes}/interactive"/>
95+
<javac srcdir="${src}" destdir="${classes}/interactive" classpathref="lib.path" debug="true" includeantruntime="false" source="${source}" target="${target}">
96+
<include name="edu/stanford/nlp/sempre/interactive/"/>
97+
</javac>
98+
<jar destfile="${libsempre}/sempre-interactive.jar" basedir="${classes}/interactive"/>
99+
</target>
100+
91101
<!-- Compile geo880 -->
92102
<target name="geo880" depends="init,core,corenlp,tables">
93103
<echo message="Compiling ${ant.project.name}: geo880"/>

interactive/README.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# README
2+
3+
This `interactive` package is the code for our paper
4+
*Naturalizing a programming language through interaction* (ACL 2017).
5+
A live demo is at [www.voxelurn.com](http://www.voxelurn.com).
6+
7+
voxelurn is a language interface to a voxel world.
8+
This server handles commands used to learn from definitions, and other interactive queries.
9+
In this setting, the system begin with the dependency-based action language (`dal.grammar`), and gradually expand the language through interacting with it users.
10+
11+
## Overview of the components
12+
13+
### sempre.interactive
14+
15+
The `edu.stanford.nlp.sempre.interactive` package live in this repo contains code for
16+
* running interactive commands (such as query, accept, reject, definition)
17+
* executor for the dependency-based action (DAL) language
18+
* voxelurn specific code in `edu.stanford.nlp.sempre.interactive.voxelurn` for actually generating the voxel and manipulating them
19+
Utilties and resources such as the grammar and run script are in this directory, and the code in in the regular `sempre/src` directory.
20+
21+
### voxelurn client
22+
23+
It queries the server, and renders the voxels to a browser. A live version is at [www.voxelurn.com](http://www.voxelurn.com), which queries our server. You can also find a client for localhost at [http://local.voxelurn.com](http://local.voxelurn.com), which is the same client, but with queries going to `http://localhost:8410` instead.
24+
Code for the client at `https://github.com/sidaw/shrdlurn`. See its [README.md](https://github.com/sidaw/shrdlurn/blob/master/README.md) if you want to work with and build the client yourself.
25+
26+
27+
### voxelurn community server
28+
Located at `interactive/community-server`, the community server
29+
handles other functionalities such as logging client actions, leaderboard, submiting structures, authentication etc. and generally functions not related to parsing. This server is needed for running interactive experiments, but is not required just for trying out voxelurn.
30+
31+
32+
## Running the SEMPRE server for Voxelurn
33+
34+
0. Setup SEMPRE dependencies and compile
35+
36+
./pull-dependencies core
37+
ant interactive
38+
39+
1. Start the server
40+
41+
./interactive/run @mode=voxelurn -server -interactive
42+
43+
things in the core language such as `add red left`, `repeat 3 [select left]` should work.
44+
45+
2. Feed the server existing definitions, which should take less than 2 minutes.
46+
47+
./interactive/run @mode=simulator @server=local @sandbox=none @task=freebuilddef -maxQueries 2496
48+
49+
try `add dancer` now.
50+
51+
### Interacting with the server
52+
53+
After you run the above, there are 3 ways to interact and try your own commands.
54+
55+
* The visual way is to use the client: [http://local.voxelurn.com](http://local.voxelurn.com).
56+
Code for the client is at `https://github.com/sidaw/shrdlurn` (see its [README.md](https://github.com/sidaw/shrdlurn/blob/master/README.md)).
57+
Try `[add dancer; front 5] 3 times`.
58+
59+
* Hit `Ctrl-D` on the terminal running the server, and type `add red top`, or `add green monster`
60+
61+
* On a browser, type `http://localhost:8410/sempre?q=(:q add green monster)`
62+
63+
64+
## Experiments in ACL2017
65+
66+
1. Start the server
67+
68+
./interactive/run @mode=voxelurn -server -interactive
69+
70+
2. Feed the server all the query logs
71+
72+
./interactive/run @mode=simulator @server=local @sandbox=none @task=freebuild -maxQueries 103874
73+
74+
This currently takes just under 30 minutes. Decrease maxQuery for a quicker experiment. This generate `plotInfo.json` in `./state/execs/${lastExec}.exec/` where `lastExec` is `cat ./state/lastExec`.
75+
76+
3. Taking `../state/execs/${lastExec}.exec/plotInfo.json` as input, we can analyze the data and produce some plots using the following ipython notebook
77+
78+
ipython notebook interactive/analyze_data.ipynb
79+
80+
which prints out basic statistics and generates the plots used in our paper. The plots are saved at `../state/execs/${lastExec}.exec/`
81+
82+
83+
## Misc.
84+
85+
There are some unit tests
86+
87+
./interactive/run @mode=test
88+
89+
To specify a specific test class and verbosity
90+
91+
./interactive/run @mode=test @class=DALExecutorTest -verbose 5
92+
93+
Clean up or backup data
94+
95+
./interactive/run @mode=backup # save previous data logs
96+
./interactive/run @mode=trash # deletes previous data logs
97+
98+
Data, in .gz can be found in queries.
99+
100+
* `./interactive/queries/freebuild.def.json.gz`
101+
has 2495 definitions combining just over 10k utterances.
102+
* `./interactive/queries/freebuild.json.gz` has 103873 queries made during the main experiment.
103+
104+
## Voxelurn community server (optional and in development)
105+
106+
This server helps with client side logging, leaderboard, authentication etc. basically anything that is not directly related to parsing.
107+
This component is only required if you want to run the interactive experiment yourself. It is fairly coupled with the [voxelurn client](http://github.com/sidaw/shrdlurn), which sends the request to this server.
108+
109+
cd interactive/community-server
110+
python install-deps.py
111+
python server.py --port 8403
112+
113+
# required keys for authentication
114+
export SEMPRE_JWT_SECRET=ANY_RANDOM_SEQEUNCE
115+
export SLACK_OAUTH_SECRET=OAUTH_KEY_FROM_SLACK

0 commit comments

Comments
 (0)