Skip to content

Commit 46c6dc6

Browse files
committed
d
1 parent 8677efe commit 46c6dc6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fnlp-demo/src/main/java/org/fnlp/demo/nlp/tc/TextClassificationSimple.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public static void main(String[] args) throws Exception {
5050
TextClassifier tc = new TextClassifier();
5151
System.out.println("训练模型");
5252
//用不同的Reader读取相应格式的文件
53+
//比如,(1)每个目录表示一个类别,每个目录下的每篇文档表示一个样本,可以用DocumentReader
54+
//(2)每个文件表示一个类别,每个文件下的每一行表示一个样本,可以用FileReader
55+
//(3)LIBSVM训练文件格式,可以用svmFileReader
56+
//(4)所有数据在一个文件,格式为: 类别 + “分隔符” + 数据,可以用SimpleFileReader
57+
//(5)自定义Reader,继承Reader接口
5358
Reader reader = new FileReader(trainDataPath,"UTF-8",".data");
5459
tc.train(reader, modelFile);
5560
/**

0 commit comments

Comments
 (0)