Last active
November 13, 2015 02:58
-
-
Save JonyEpsilon/5baef8ac0f42706e4940 to your computer and use it in GitHub Desktop.
Using the Stanford NLP LexicalizedParser in clojure
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
;; gorilla-repl.fileformat = 1 | |
;; ** | |
;;; # Loading a lexparser | |
;; ** | |
;; @@ | |
(ns fuscia-sunset | |
(:import (edu.stanford.nlp.parser.lexparser LexicalizedParser Options))) | |
;; @@ | |
;; => | |
;;; {"type":"html","content":"<span class='clj-nil'>nil</span>","value":"nil"} | |
;; <= | |
;; @@ | |
(def parser | |
(LexicalizedParser/loadModelFromZip | |
"stanford-parser-3.4.1-models.jar" | |
"edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz")) | |
;; @@ | |
;; => | |
;;; {"type":"html","content":"<span class='clj-var'>#'fuscia-sunset/parser</span>","value":"#'fuscia-sunset/parser"} | |
;; <= | |
;; @@ | |
(.parse parser "Hello, world!") | |
;; @@ | |
;; => | |
;;; {"type":"html","content":"<span class='clj-unkown'>#<LabeledScoredTreeNode (ROOT (FRAG (INTJ (UH Hello)) (, ,) (NP (NN world)) (. !)))></span>","value":"#<LabeledScoredTreeNode (ROOT (FRAG (INTJ (UH Hello)) (, ,) (NP (NN world)) (. !)))>"} | |
;; <= | |
;; @@ | |
;; @@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment