Skip to content

Commit

Permalink
Updated readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ptnplanet committed Nov 20, 2013
1 parent 40e5fab commit 920dab0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 77 deletions.
72 changes: 0 additions & 72 deletions README

This file was deleted.

18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
Naive Bayes Classifier implemented in Java.
Java Naive Bayes Classifier
==================

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.

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.
Example
------------------

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.

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

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

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

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

// Change the memory capacity.
// Change the memory capacity. New learned classifications (using
// learn method are stored in a queue with the size given here and
// used to classify unknown sentences.
bayes.setMemoryCapacity(500);
```

Expand Down

0 comments on commit 920dab0

Please sign in to comment.