hanlp.naiveBayesClassify: Naive Bayes classifier.

Description Usage Format Details Usage Methods Author(s) Examples

Description

a R6 class of naive Bayes classifier.

Usage

1

Format

R6Class object.

Details

A R6class of naive Bayes classifier .

Usage

For usage details see Methods, Arguments and Examples sections.

1
2
3
4
5
naiveBayes = hanlp.naiveBayesClassify$new()
naiveBayes$train(file_folder)
naiveBayes$predict(text)
naiveBayes$test(test_data)
naiveBayes$getModel()

Methods

$new()

Constructor for Naive Bayes classifier.

$train(file_folder)

Train Naive Bayes classifier,detail in https://github.com/hankcs/HanLP/wiki .

$predict(text)

Predict text category.

$test(test_data)

Predict a batch of text categories,test_data is a character vector.

$getModel()

Output some infomation of Naive Bayes model.

Author(s)

qxde01

Examples

1
2
3
4
5
6
7
8
## Not run: 
naiveBayes = hanlp.naiveBayesClassify$new()
naiveBayes$train(file_folder)
naiveBayes$predict(text)
naiveBayes$test(test_data)
naiveBayes$getModel()

## End(Not run)

qxde01/RHanLP documentation built on May 13, 2019, 8:39 a.m.