Last active
August 29, 2015 13:57
-
-
Save saludes/9364597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my-gf-java.core) | |
(def WS_DOC_ROOT | |
(let [pwd (System/getenv "PWD")] | |
(str pwd "/resources/"))) | |
(def WS_PORT 41297) | |
(def WS_URL_LOCALHOST (str "http://localhost:" WS_PORT)) | |
(let [server (str " -server=" WS_PORT) | |
doc-root (str " --document-root=" WS_DOC_ROOT)] | |
(println (str "Please run on shell: gf" server doc-root))) | |
(import 'ch.uzh.ifi.attempto.gfservice.gfwebservice.GfWebService) | |
(def WS_URI (java.net.URI. WS_URL_LOCALHOST)) | |
(def gf (GfWebService. WS_URI "/grammars/Go.pgf")) | |
(defn eng-parse-one [input cat] | |
(let [lang "GoEng" | |
trees (.getTrees (.parse gf cat input lang) lang)] | |
(cond | |
(empty? trees) (println "No parsings") | |
(> (count trees) 1) (println "Ambiguous") | |
:else (first trees)))) | |
(defn est-lin [tree] | |
(.getTexts (.linearize gf tree "GoEst"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject my-gf-java "0.1.0-SNAPSHOT" | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[com.googlecode.json-simple/json-simple "1.1"] | |
[com.google.guava/guava "11.0.2"] | |
[org.apache.httpcomponents/httpcore "4.1.1"] | |
[org.apache.httpcomponents/httpclient "4.1.1"] | |
[local/bar "1.0.0"]] | |
:repositories {"project" "file:repo"}) |
There is a resurces/grammars folder where Go.pgf resides.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using
I followed the instructions of https://gist.github.com/stuartsierra/3062743 with gf-java-0.8.1.jar but changing
install:install-file
todeploy:deploy-file
as directed in the first comment.