Skip to content

Commit

Permalink
Update usage in README for new test content
Browse files Browse the repository at this point in the history
  • Loading branch information
briancline committed Oct 30, 2013
1 parent 72a6862 commit e99669b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,24 @@ To use the module, create an instance of the `Classifier` class, giving it the
path to a directory where the data files will be stored, and a list of all
possible category strings--or labels--under which text will be classified.

c = Classifier("/path/to/my/data", ["good", "bad"])
c = Classifier('/path/to/my/data', ['good', 'bad'])

To teach the classifier object about some text, call the learn method passing
in a category (one of the categories that you previously provided), and the
text.

c.learn("good", "some good text")
c.learn("bad", "some bad text")
c.learn('good', 'some good text')
c.learn('bad', 'some bad text')

To find out what the classifier thinks about a body of text, call the classify
method, passing in the text. The result of this method is a pair: the first
item is a category best matching the text, and the second item is the
confidence/probability of that match.

label, confidence = c.classify("some text")
label, confidence = c.classify('some text')

For a rather contrived but possibly helpful detailed example, see
`tests/basic.py`.


License
Expand Down

0 comments on commit e99669b

Please sign in to comment.