AI-Classifier-Japanese
view release on metacpan or search on metacpan
# NAME
AI::Classifier::Japanese - the combination wrapper of Algorithm::NaiveBayes and
Text::MeCab.
# SYNOPSIS
use AI::Classifier::Japanese;
# Create new instance
my $classifier = AI::Classifier::Japanese->new();
# Add training text
$classifier->add_training_text("ãã®ããï¼æ¥½ããï¼", 'positive');
$classifier->add_training_text("ã¤ããï¼è¾ãï¼", 'negative');
# Train
$classifier->train;
# Test
my $result_ref = $classifier->predict("ãã®ãã");
print $result_ref->{'positive'}; # => Confidence value
# DESCRIPTION
AI::Classifier::Japanese is a Japanese-text category classifier module using Naive Bayes and MeCab.
This module is based on Algorithm::NaiveBayes.
Only noun, verb and adjective are currently supported.
# METHODS
- `my $classifier = AI::Classifier::Japanese->new();`
Create new instance of AI::Classifier::Japanese.
- `$classifier->add_training_text($text, $category);`
Add training text.
- `$classifier->train;`
Train.
- `my $result_ref = $classifier->predict($text);`
Test and returns a predicted result hash reference which has a confidence value for each category.
- `$classifier->save_state($params_path);`
Save parameters.
- `$classifier->restore_state($params_path);`
Restore parameters from a file.
- `my @labels = $classifier->labels;`
Get category labels as an array reference.
# LICENSE
Copyright (C) Shinichi Goto.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
# AUTHOR
Shinichi Goto <shingtgt @ GMAIL COM>
( run in 0.239 second using v1.01-cache-2.11-cpan-4d50c553e7e )