Package nltk :: Package classify :: Module weka :: Class ARFF_Formatter
[hide private]
[frames] | no frames]

Class ARFF_Formatter

source code

Converts featuresets and labeled featuresets to ARFF-formatted strings, appropriate for input into Weka.

Instance Methods [hide private]
 
__init__(self, labels, features) source code
 
format(self, tokens) source code
 
labels(self) source code
 
write(self, filename, tokens) source code
 
header_section(self) source code
 
data_section(self, tokens, labeled=None) source code
 
_fmt_arff_val(self, fval) source code
Static Methods [hide private]
 
from_train(tokens) source code
Method Details [hide private]

__init__(self, labels, features)
(Constructor)

source code 
Parameters:
  • labels - A list of all labels that can be generated.
  • features - A list of feature specifications, where each feature specification is a tuple (fname, ftype); and ftype is an ARFF type string such as NUMERIC or STRING.

data_section(self, tokens, labeled=None)

source code 
Parameters:
  • labeled - Indicates whether the given tokens are labeled or not. If None, then the tokens will be assumed to be labeled if the first token's value is a tuple or list.