From f0248a0c2b638998cd0a9218be7d8b1500deb0ba Mon Sep 17 00:00:00 2001 From: Panupong Pasupat Date: Tue, 15 Nov 2016 14:02:14 -0800 Subject: [PATCH] Updated contents on SPARQL in README / TUTORIAL --- README.md | 10 +++------- TUTORIAL.md | 16 +++++++--------- run | 16 ++++++++++++++++ src/edu/stanford/nlp/sempre/JoinFn.java | 4 ++-- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 8f68d66..b84423f 100644 --- a/README.md +++ b/README.md @@ -123,16 +123,12 @@ For Ubuntu, follow this: sudo apt-get install -y automake gawk gperf libtool bison flex libssl-dev # Clone the repository - git clone https://github.com/openlink/virtuoso-opensource + ./pull-dependencies virtuoso + + # Make and install cd virtuoso-opensource - git checkout tags/v7.0.0 - - # Configure ./autogen.sh - mv INSTALL INSTALL.txt # Avoid conflict on case-insensitive file systems ./configure --prefix=$PWD/install - - # Make (this takes a while) make make install cd .. diff --git a/TUTORIAL.md b/TUTORIAL.md index 075063b..3e43afb 100644 --- a/TUTORIAL.md +++ b/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 *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 @@ -32,7 +33,7 @@ shell command and executes it. To see which command is run, do: 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: @@ -586,7 +587,7 @@ To stop the server: ### Setting up a copy of Freebase 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. 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: - ./run @mode=simple-freebase @sparqlserver=localhost:3001 - -The simplest logical formula in lambda DCS is a single entity: - - fb:en.california + ./run @mode=simple-freebase-nocache @sparqlserver=localhost:3001 +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: (execute fb:en.california) @@ -753,7 +751,7 @@ is the basis for the overloading. 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: diff --git a/run b/run index 108b581..47c79cc 100755 --- a/run +++ b/run @@ -489,6 +489,22 @@ addMode('simple-freebase', 'Simple shell for using Freebase', lambda { |e| l( o('Main.interactive'), 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 diff --git a/src/edu/stanford/nlp/sempre/JoinFn.java b/src/edu/stanford/nlp/sempre/JoinFn.java index 95220be..da53140 100644 --- a/src/edu/stanford/nlp/sempre/JoinFn.java +++ b/src/edu/stanford/nlp/sempre/JoinFn.java @@ -23,10 +23,10 @@ public class JoinFn extends SemanticFn { public static class Options { @Option(gloss = "Verbose") public int verbose = 0; @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 // 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();