On Thu, May 19, 2011 at 5:47 PM, Andreas Kostler
wrote:
> Hi Armando,
> I'm working on a Clojurej library for sentiment analysis which doesn't
> contain everything you'd want for nlp but quite a nice subset of input
> modules (plain text corpora, rss feeds, html, etc...),
> tokenising/normalisin
Hi Armando,
I'm working on a Clojurej library for sentiment analysis which doesn't contain
everything you'd want for nlp but quite a nice subset of input modules (plain
text corpora, rss feeds, html, etc...),
tokenising/normalising filters (noise removal, porter stemmer, etc),
distance/similarit
Just in case I'll mention that Meikel's use of (with-open) will
automatically close the reader.
On May 19, 11:40 am, dokondr wrote:
> On May 19, 6:52 pm, Meikel Brandmeyer wrote:
>
> > Hi,
>
> > something like the following should work.
>
> > (with-open [rdr (java.io.FileReader. "file.txt")]
> >
On May 19, 6:52 pm, Meikel Brandmeyer wrote:
> Hi,
>
> something like the following should work.
>
> (with-open [rdr (java.io.FileReader. "file.txt")]
> (doseq [line (line-seq rdr)
> word (.split line "\\s")]
> (when (.endsWith word "ing")
> (println word
>
> Sincerely
>
I think there can be multiple words on each line, so they have to be split
into words first. Maybe something like:
(ns example
(:use [clojure.contrib.duck-streams :only (read-lines)]))
(let [lines (read-lines "file.txt")
words (mapcat #(.split % "\\s") lines)
ing-words (filter (pa
There is clojure.contrib.duck-streams/read-lines
http://clojuredocs.org/clojure_contrib/clojure.contrib.duck-streams/read-lines
Then it's a matter of
(filter (partial re-matches #".*ing") (read-lines "/path/to/file"))
Jonathan
On Thu, May 19, 2011 at 4:52 PM, Meikel Brandmeyer wrote:
> Hi,
>