Skip to content
This repository was archived by the owner on May 7, 2021. It is now read-only.

Commit 920dab0

Browse files
committed
Updated readme.md
1 parent 40e5fab commit 920dab0

2 files changed

Lines changed: 13 additions & 77 deletions

File tree

README

Lines changed: 0 additions & 72 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
Naive Bayes Classifier implemented in Java.
1+
Java Naive Bayes Classifier
22
==================
33

44
Nothing special. It works and is well documented, so you should get it running without wasting too much time searching for other alternatives on the net.
55

6-
Here is an excerpt from the example. The classifier will classify strings as either positive or negative sentiment. Please refer to the full example for a more detailed documentation.
6+
Example
7+
------------------
8+
9+
Here is an excerpt from the example. The classifier will classify sentences (arrays of features) as sentences with either positive or negative sentiment. Please refer to the full example for a more detailed documentation.
710

811
```java
12+
// Create a new bayes classifier with string categories and string features.
913
Classifier<String, String> bayes = new BayesClassifier<String, String>();
1014

1115
// Two examples to learn from.
1216
String[] positiveText = "I love sunny days".split("\\s");
1317
String[] negativeText = "I hate rain".split("\\s");
1418

15-
// Learn by classifying examples. New categories can be added on the fly,
16-
// when they are first used.
19+
// Learn by classifying examples.
20+
// New categories can be added on the fly, when they are first used.
21+
// A classification consists of a category and a list of features
22+
// that resulted in the classification in that category.
1723
bayes.learn("positive", Arrays.asList(positiveText));
1824
bayes.learn("negative", Arrays.asList(negativeText));
1925

@@ -30,7 +36,9 @@ System.out.println( // will output "negative"
3036
((BayesClassifier<String, String>) bayes).classifyDetailed(
3137
Arrays.asList(unknownText1));
3238

33-
// Change the memory capacity.
39+
// Change the memory capacity. New learned classifications (using
40+
// learn method are stored in a queue with the size given here and
41+
// used to classify unknown sentences.
3442
bayes.setMemoryCapacity(500);
3543
```
3644

0 commit comments

Comments
 (0)