2

Despite adding the desired dependency to my project.clj file,

(defproject word-tree "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}

  :dependencies [[org.clojure/clojure "1.10.1"]
                 [org.clojure/clojurescript "1.10.520"]
                 [clojure-opennlp "0.5.0"] ; <----------------------here
                 [reagent "0.8.1"]]
 ...

I am unable to access the functions that the dependency provides.

After referencing the namespace in one of my files,

(ns word-tree.suffix-tree
  (:require [clojure.string :as str]
            [opennlp.nlp :as nlp])) ; <-----this is the namespace of the dependency

I get this error:

No such namespace: opennlp.nlp, could not locate opennlp/nlp.cljs, opennlp/nlp.cljc, or JavaScript source providing "opennlp.nlp"

The weirdest part is that when I run lein deps :tree the dependency shows up!

$ lein deps :tree
...
[cider/piggieback "0.4.1" :scope "test"]
 [cljfmt "0.5.7"]
   [rewrite-clj "0.5.2"]
   [rewrite-cljs "0.4.3"]
 [clojure-complete "0.2.5" :exclusions [[org.clojure/clojure]]]
 [clojure-opennlp "0.5.0"] <------------------------------------------------here!!!
   [instaparse "1.4.9"]
   [org.apache.opennlp/opennlp-tools "1.9.0"]
 [figwheel-sidecar "0.5.19" :scope "test"]
...

For my project I really want to use this dependency but it's not working. Any advice would be most welcome. Thanks.

1 Answer 1

5

It seems to me the problem is that the library is for Clojure on the JVM only, and you are trying to use it on a ClojureScript project.

No such namespace: opennlp.nlp, could not locate opennlp/nlp.cljs, opennlp/nlp.cljc, or JavaScript source providing "opennlp.nlp"

The compiler tried to look for ClojureScript code (extension .cljs) or compatible with both Clojure and ClojureScript (extension .cljc) or plain JavaScript, but found none.

Sign up to request clarification or add additional context in comments.

1 Comment

The problem is that Apache OpenNLP is itself a Java library so the Clojure wrapper can't so much about that. One option could be that your ClojureScript project calls an endpoint for a service written using clojure-opennlp, but in that case you'll have 2 projects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.