Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'alexott/master'

  • Loading branch information...
commit 19970b88c50662e4933e76dcf3cabc88417e3c98 2 parents 2fb9e10 + c7c0999
@dakrone authored
View
15 src/opennlp/nlp.clj
@@ -20,10 +20,10 @@
;; OpenNLP property for pos-tagging. Meant to be rebound before
;; calling the tagging creators
-(def #^{:dynamic true} *beam-size* 3)
+(def ^:dynamic *beam-size* 3)
;; Caching to use for pos-tagging
-(def #^{:dynamic true} *cache-size* 1024)
+(def ^:dynamic *cache-size* 1024)
(defn- opennlp-span-strings
"Takes a collection of spans and the data they refer to. Returns a list of
@@ -123,12 +123,13 @@ start and end positions of the span."
(fn name-finder
[tokens & contexts]
{:pre [(seq tokens)
- (every? #(= (class %) String) tokens)]}
+ (every? string? tokens)]}
(let [finder (NameFinderME. model feature-generator beam)
- matches (.find finder (into-array String tokens))
+ a-tokens (into-array String tokens)
+ matches (.find finder a-tokens)
probs (seq (.probs finder))]
(with-meta
- (distinct (Span/spansToStrings matches (into-array String tokens)))
+ (distinct (Span/spansToStrings matches a-tokens))
{:probabilities probs
:spans (map to-native-span matches)}))))
@@ -215,7 +216,7 @@ start and end positions of the span."
(fn detokenizer
[tokens]
{:pre [(coll? tokens)
- (every? #(= (class %) String) tokens)]}
+ (every? string? tokens)]}
(let [detoken (DictionaryDetokenizer. model)
ops (.detokenize detoken (into-array String tokens))]
(detokenize* tokens ops))))
@@ -225,7 +226,7 @@ start and end positions of the span."
(fn detokenizer
[tokens]
{:pre [(coll? tokens)
- (every? #(= (class %) String) tokens)]}
+ (every? string? tokens)]}
(-> (DictionaryDetokenizer. model)
(TokenSample. (into-array String tokens))
(.getText))))
View
2  src/opennlp/tools/train.clj
@@ -29,7 +29,7 @@
(defn write-model
"Write a model to disk"
- [#^BaseModel model out-stream]
+ [^BaseModel model out-stream]
(with-open [out (output-stream out-stream)]
(.serialize model out)))
View
4 src/opennlp/treebank.clj
@@ -1,4 +1,4 @@
-(ns #^{:doc "Namespace containing tools pertaining to the treebank NLP tools.
+(ns ^{:doc "Namespace containing tools pertaining to the treebank NLP tools.
This includes treebank chuncking, parsing and linking (coref)."
:author "Lee Hinman"}
opennlp.treebank
@@ -14,7 +14,7 @@
;; Default advance percentage as defined by
;; AbstractBottomUpParser.defaultAdvancePercentage
-(def #^{:dynamic true} *advance-percentage* 0.95)
+(def ^:dynamic *advance-percentage* 0.95)
(defn- split-chunks
"Partition a sequence of treebank chunks by their phrases."
Please sign in to comment.
Something went wrong with that request. Please try again.