mirror of https://github.com/percyliang/sempre
Updated contents on SPARQL in README / TUTORIAL
This commit is contained in:
parent
3b31ba7aef
commit
f0248a0c2b
10
README.md
10
README.md
|
|
@ -123,16 +123,12 @@ For Ubuntu, follow this:
|
||||||
sudo apt-get install -y automake gawk gperf libtool bison flex libssl-dev
|
sudo apt-get install -y automake gawk gperf libtool bison flex libssl-dev
|
||||||
|
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
git clone https://github.com/openlink/virtuoso-opensource
|
./pull-dependencies virtuoso
|
||||||
|
|
||||||
|
# Make and install
|
||||||
cd virtuoso-opensource
|
cd virtuoso-opensource
|
||||||
git checkout tags/v7.0.0
|
|
||||||
|
|
||||||
# Configure
|
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
mv INSTALL INSTALL.txt # Avoid conflict on case-insensitive file systems
|
|
||||||
./configure --prefix=$PWD/install
|
./configure --prefix=$PWD/install
|
||||||
|
|
||||||
# Make (this takes a while)
|
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
||||||
16
TUTORIAL.md
16
TUTORIAL.md
|
|
@ -17,7 +17,8 @@ Recall that in semantic parsing, *natural language utterances* are mapped into
|
||||||
*logical forms* (think programs), which are executed to produce some
|
*logical forms* (think programs), which are executed to produce some
|
||||||
*denotation* (think return value).
|
*denotation* (think return value).
|
||||||
|
|
||||||
We have assumed you have already downloaded SEMPRE and can open up a shell:
|
We have assumed you have already [installed](README.md#installation)
|
||||||
|
SEMPRE and can open up a shell:
|
||||||
|
|
||||||
./run @mode=simple
|
./run @mode=simple
|
||||||
|
|
||||||
|
|
@ -32,7 +33,7 @@ shell command and executes it. To see which command is run, do:
|
||||||
|
|
||||||
This should print out:
|
This should print out:
|
||||||
|
|
||||||
rlwrap java -cp libsempre/*:lib/* -ea edu.stanford.nlp.sempre.Main -interactive
|
java -cp libsempre/*:lib/* -ea edu.stanford.nlp.sempre.Main -Main.interactive
|
||||||
|
|
||||||
You can pass in additional options:
|
You can pass in additional options:
|
||||||
|
|
||||||
|
|
@ -586,7 +587,7 @@ To stop the server:
|
||||||
### Setting up a copy of Freebase
|
### Setting up a copy of Freebase
|
||||||
|
|
||||||
The best case is someone already installed Freebase for you and handed you a
|
The best case is someone already installed Freebase for you and handed you a
|
||||||
host:port. Otherwise, to run your own copy of the Freebase graph (a
|
host:port. Otherwise, to run your own copy of the entire Freebase graph (a
|
||||||
2013 snapshot), read on.
|
2013 snapshot), read on.
|
||||||
|
|
||||||
Download it (this is really big and takes a LONG time):
|
Download it (this is really big and takes a LONG time):
|
||||||
|
|
@ -611,12 +612,9 @@ We assume you have started the Virtuoso database:
|
||||||
|
|
||||||
Then start up a prompt:
|
Then start up a prompt:
|
||||||
|
|
||||||
./run @mode=simple-freebase @sparqlserver=localhost:3001
|
./run @mode=simple-freebase-nocache @sparqlserver=localhost:3001
|
||||||
|
|
||||||
The simplest logical formula in lambda DCS is a single entity:
|
|
||||||
|
|
||||||
fb:en.california
|
|
||||||
|
|
||||||
|
The simplest logical formula in lambda DCS is a single entity such as `fb:en.california`.
|
||||||
To execute this query, simply type the following into the interactive prompt:
|
To execute this query, simply type the following into the interactive prompt:
|
||||||
|
|
||||||
(execute fb:en.california)
|
(execute fb:en.california)
|
||||||
|
|
@ -753,7 +751,7 @@ is the basis for the overloading.
|
||||||
|
|
||||||
Now start the interactive prompt:
|
Now start the interactive prompt:
|
||||||
|
|
||||||
./run @mode=simple-freebase @sparqlserver=localhost:3001 -Grammar.inPaths freebase/data/tutorial-freebase.grammar -SimpleLexicon.inPaths freebase/data/tutorial-freebase.lexicon
|
./run @mode=simple-freebase-nocache @sparqlserver=localhost:3001 -Grammar.inPaths freebase/data/tutorial-freebase.grammar -SimpleLexicon.inPaths freebase/data/tutorial-freebase.lexicon
|
||||||
|
|
||||||
We should be able to parse the following utterances:
|
We should be able to parse the following utterances:
|
||||||
|
|
||||||
|
|
|
||||||
16
run
16
run
|
|
@ -489,6 +489,22 @@ addMode('simple-freebase', 'Simple shell for using Freebase', lambda { |e| l(
|
||||||
o('Main.interactive'),
|
o('Main.interactive'),
|
||||||
nil) })
|
nil) })
|
||||||
|
|
||||||
|
addMode('simple-freebase-nocache', 'Simple shell for using Freebase (without a cache server)', lambda { |e| l(
|
||||||
|
'java', '-Dmodules=core,freebase', '-cp', 'libsempre/*:lib/*', '-ea', 'edu.stanford.nlp.sempre.Main',
|
||||||
|
o('executor', 'freebase.SparqlExecutor'),
|
||||||
|
letDefault(:sparqlserver, 'freebase.cloudapp.net:3093'),
|
||||||
|
sparqlOpts,
|
||||||
|
o('FeatureExtractor.featureDomains', 'rule'),
|
||||||
|
o('Parser.coarsePrune'),
|
||||||
|
o('JoinFn.typeInference'),
|
||||||
|
o('UnaryLexicon.unaryLexiconFilePath', '/dev/null'),
|
||||||
|
o('BinaryLexicon.binaryLexiconFilesPath', '/dev/null'),
|
||||||
|
#o('JoinFn.showTypeCheckFailures'), # Use this to debug
|
||||||
|
o('Grammar.inPaths', 'freebase/data/demo1.grammar'), # Override with your own custom grammar
|
||||||
|
#o('SparqlExecutor.includeSupportingInfo'), # Show full information
|
||||||
|
o('Main.interactive'),
|
||||||
|
nil) })
|
||||||
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# {2014-12-27} [Percy]: Overnight semantic parsing
|
# {2014-12-27} [Percy]: Overnight semantic parsing
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@ public class JoinFn extends SemanticFn {
|
||||||
public static class Options {
|
public static class Options {
|
||||||
@Option(gloss = "Verbose") public int verbose = 0;
|
@Option(gloss = "Verbose") public int verbose = 0;
|
||||||
@Option public boolean showTypeCheckFailures = false;
|
@Option public boolean showTypeCheckFailures = false;
|
||||||
@Option public boolean typeInference = false;
|
@Option public boolean typeInference = true;
|
||||||
// TODO(joberant): this flag is for backward compatibility. If we don't
|
// TODO(joberant): this flag is for backward compatibility. If we don't
|
||||||
// need it for the new results, get rid of it.
|
// need it for the new results, get rid of it.
|
||||||
@Option public boolean specializedTypeCheck = true;
|
@Option public boolean specializedTypeCheck = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Options opts = new Options();
|
public static Options opts = new Options();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue