dakrone / clojure-opennlp

Natural Language Processing in Clojure (opennlp)
Eclipse Public License 1.0
753 stars 81 forks source link

IOException Mark invalid java.BufferedReader.reset (BufferedReader.java:505) #30

Open goldfeld opened 11 years ago

goldfeld commented 11 years ago

I'm getting this error when I try to use the following sample code from the readme:

(with-open [rdr (clojure.java.io/reader "/tmp/bigfile")]
  (let [sentences (sentence-seq rdr get-sentences)]
    ;; process your lazy seq of sentences however you desire
    (println "first 5 sentences:")
    (clojure.pprint/pprint (take 5 sentences))))

My file exists and I'm able to do (slurp "/tmp/bigfile") I'm new to Clojure so I'm sorry if it's a basic java interop issue. Nevertheless I successfully imported the get-sentences and sentence-seq functions and have otherwise been able to use the library without problems.

dakrone commented 11 years ago

Cool, I'll look into it, thanks for reporting it!

dakrone commented 11 years ago

Hmm.. I'm unable to reproduce it:

user=> (with-open [rdr (clojure.java.io/reader "/tmp/bigfile")]
  #_=>   (let [sentences (sentence-seq rdr get-sentences)]
  #_=>     ;; process your lazy seq of sentences however you desire
  #_=>     (println "first 5 sentences:")
  #_=>     (clojure.pprint/pprint (take 5 sentences))))
first 5 sentences:
("this is a sentence."
 "this is a sentence."
 "this is a sentence."
 "this is a sentence."
 "this is a sentence.")
nil

What version of clojure-opennlp are you using? What are the contents of /tmp/bigfile?