Skip to content

Commit

Permalink
Fixed issue #3 - bug introduced in 0.0.3 handling related synsets
Browse files Browse the repository at this point in the history
  • Loading branch information
rm-hull committed Oct 19, 2013
1 parent daf6d28 commit 3e85e19
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ Changelog
-----------------------
* Fixed reflection warnings
* Nil and empty/trimmed string short circuiting

0.0.5 (Sat Oct 19 2013)
-----------------------
* Fixed issue #3 - bug introduced in 0.0.3 handling related synsets
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ There is an initial version hosted at [Clojars](https://clojars.org/clj-wordnet/
For leiningen include a dependency:

```clojure
[clj-wordnet "0.0.4"]
[clj-wordnet "0.0.5"]
```

For maven-based projects, add the following to your `pom.xml`:
Expand All @@ -31,7 +31,7 @@ For maven-based projects, add the following to your `pom.xml`:
<dependency>
<groupId>clj-wordnet</groupId>
<artifactId>clj-wordnet</artifactId>
<version>0.0.4</version>
<version>0.0.5</version>
</dependency>
```

Expand Down Expand Up @@ -63,7 +63,7 @@ separately from [here](http://wordnet.princeton.edu/wordnet/download/current-ver

(def frump (first (wordnet "frump" :noun)))

(map :lemma (related-words frump :derivationally-related)))
(map :lemma (related-words frump :derivationally-related))
=> ("frumpy")

(map :lemma (flatten (vals (related-synsets dog :hypernym))))
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject clj-wordnet "0.0.4"
(defproject clj-wordnet "0.0.5"
:description "A WordNet/JWI wrapper library"
:url "https://github.com/delver/clj-wordnet"
:license {:name "Creative Commons 3.0"
Expand Down
3 changes: 1 addition & 2 deletions src/clj_wordnet/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
^IWord word (:word m)]
(apply merge-with concat
(for [synset-id (.getRelatedSynsets (.getSynset word) (coerce/pointer pointer))
^ISynset synset (locking coarse-lock (.getSynset dict synset-id))
word (.getWords synset) ]
word (.getWords (locking coarse-lock (.getSynset dict synset-id)))]
{ synset-id [(from-java dict word)] }))))

(defn related-words
Expand Down
4 changes: 4 additions & 0 deletions test/clj_wordnet/test/client.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
(deftest fetch-nil-word
(is (empty? (wordnet nil))))

(deftest relational-synset-test
(let [dog (first (wordnet "dog" :noun))]
(is (= '("domestic_animal" "domesticated_animal" "canine" "canid")
(map :lemma (flatten (vals (related-synsets dog :hypernym))))))))

0 comments on commit 3e85e19

Please sign in to comment.