请让我知道如何在 weka 中表示文本分类的属性或类。通过使用什么属性可以进行分类?词频还是词?ARFF 格式的可能结构是什么?你能给我几行该结构的例子吗?
非常感谢您提前。
请让我知道如何在 weka 中表示文本分类的属性或类。通过使用什么属性可以进行分类?词频还是词?ARFF 格式的可能结构是什么?你能给我几行该结构的例子吗?
非常感谢您提前。
One of the easiest alternatives is to start with an ARFF file for a two class problem like:
@relation corpus @attribute text string @attribute class {pos,neg} @data 'long text with words ... ',pos
The text is represented as a String type and the class is a nominal with two values.
Then you could apply two filters:
You may find more info and other approaches to transform your data in this Weka wiki page: http://weka.wikispaces.com/Text+categorization+with+WEKA
在 weka 中,您可以选择自己的属性。在此示例中,我们只有 2 个类,并且所有唯一词都用作属性。如果您选择词频作为属性,则如果该词在文本中出现两次,则分配“2”,否则分配“0”,如果该词仅出现一次,则分配“1”。
这是示例 .arff 格式。
@RELATION anyrelation
@ATTRIBUTE word1
@ATTRIBUTE word2
...
@ATTRIBUTE wordn
@ATTRIBUTE class {class1, class2}
@DATA
1,2,....,0,class1
0,3,....,1,class2