Skip to content

Commit

Permalink
Added case-insensitive word filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ogrim committed Jan 23, 2012
1 parent 2648772 commit 2f08975
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -6,7 +6,7 @@ clj-obt supports Linux only, and you must acquire the tagger from http://tekstla

## Installation

Simply add the library with Leiningen: `[clj-obt "0.3.3"]` and require `clj-obt.core`
Simply add the library with Leiningen: `[clj-obt "0.3.4"]` and require `clj-obt.core`

## Usage

Expand Down
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject clj-obt "0.3.3"
(defproject clj-obt "0.3.4"
:description "Library for accessing the Oslo-Bergen-Tagger, and parsing of the output."
:url "http://github.com/ogrim/clj-obt"
:dependencies [[org.clojure/clojure "1.3.0"]])
10 changes: 9 additions & 1 deletion src/clj_obt/tools.clj
Expand Up @@ -54,9 +54,17 @@
(let [tag-set (apply hash-set tags)]
(filter #(some tag-set (:tags %)) parsed)))

(defn filter-word [parsed word]
(defn filter-word
"Return all tags in parsed which matches the case-sensitive word"
[parsed word]
(filter #(= (:word %) word) parsed))

(defn filter-word-insensitive
"Return all tags in parsed which matches the case-insensitive word"
[parsed word]
(let [w (.toLowerCase word)]
(filter #(= (.toLowerCase (:word %)) w) parsed)))

(defn remove-tag [parsed tag]
(filter #(not (compare-tags tag %)) parsed))

Expand Down

0 comments on commit 2f08975

Please sign in to comment.