# TextAnalysis.jl Naive Bayes Error

**URL:** https://discourse.julialang.org/t/textanalysis-jl-naive-bayes-error/44895
**Category:** New to Julia
**Created:** [August 13, 2020, 8:33pm UTC](https://discourse.julialang.org/t/textanalysis-jl-naive-bayes-error/44895 "2020-08-13T20:33:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Chris\_Anderson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_anderson/32/9465_2.png) [@Chris\_Anderson](https://discourse.julialang.org/u/Chris_Anderson)
#### Post date: [August 13, 2020, 8:33pm UTC](https://discourse.julialang.org/t/textanalysis-jl-naive-bayes-error/44895/1 "2020-08-13T20:33:35Z")

</div>

I am trying to use TextAnalysis.jl for some text classification using the Naive Bayes Classifier. However, I’ve been unable to begin as I’m getting an error before I can even load the classifier.

`using TextAnalysis: NaiveBayesClassifier, fit!, predict`

Produces this error

`ERROR: UndefVarError: NaiveBayesClassifier not defined`

I know TextAnalysis.jl is intalled and it loads on its own (`using TextAnalysis`). How can I fix this?

Chris

---

<div class="post-metadata">

### Author: ![Chris\_Townsend](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_townsend/32/17527_2.png) [@Chris\_Townsend](https://discourse.julialang.org/u/Chris_Townsend)
#### Post date: [August 28, 2020, 2:59am UTC](https://discourse.julialang.org/t/textanalysis-jl-naive-bayes-error/44895/2 "2020-08-28T02:59:10Z")

</div>

Ever figure this out? I’m getting this right now too.

---

<div class="post-metadata">

### Author: ![jkbest2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jkbest2/32/7350_2.png) [@jkbest2](https://discourse.julialang.org/u/jkbest2)
#### Post date: [August 28, 2020, 3:22am UTC](https://discourse.julialang.org/t/textanalysis-jl-naive-bayes-error/44895/3 "2020-08-28T03:22:52Z")

</div>

It looks like this was just fixed, but I don’t think a new version has been registered yet:

[https://github.com/JuliaText/TextAnalysis.jl/pull/217](https://github.com/JuliaText/TextAnalysis.jl/pull/217)

You can install it using `]add TextAnalysis#master`.

---

<div class="post-metadata">

### Author: ![Chris\_Townsend](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_townsend/32/17527_2.png) [@Chris\_Townsend](https://discourse.julialang.org/u/Chris_Townsend)
#### Post date: [August 28, 2020, 3:31am UTC](https://discourse.julialang.org/t/textanalysis-jl-naive-bayes-error/44895/4 "2020-08-28T03:31:42Z")

</div>

Thank you @jkbest2. I just saw that too. I’m just getting into Julia so am learning as I go. After reading some more docs, I see that one can add a package from Github like this:

From the Julia command prompt, type `]` and that brings you to the Pkg command prompt.

From the Pkg command prompt:

```julia
pkg> add "https://github.com/JuliaText/TextAnalysis.jl"

```

After it installs hit BACKSPACE and Bob’s your uncle. I can confirm that the new fix works and is available via that modified install process.

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [August 30, 2020, 4:43pm UTC](https://discourse.julialang.org/t/textanalysis-jl-naive-bayes-error/44895/6 "2020-08-30T16:43:34Z")

</div>

Several years ago I tried to get one of the NaiveBayes classifiers in the ecosystem to work, and after spending 2hrs grappling with it I decided to just write my own (it’s a very simple algorithm). Maybe things are better now(IE: after getting the install maybe it will work?), but that is another option depending on where you are with things and what you need and when. I can help with that and may already have some suitable building blocks laying around somewhere to kick start it…
