1
2
3
4
5
6
7
8 from nltk_lite.contrib.classifier.exceptions import systemerror as se
9 from nltk_lite.contrib.classifier import autoclass as ac, cfile, decisionstump as ds
10 import UserList
11
12 CONTINUOUS = 'continuous'
13 DISCRETE = 'discrete'
14
16 - def __init__(self, name, values, index):
21
26
29
32
36
38 if other is None: return False
39 if self.__class__ != other.__class__: return False
40 if self.name == other.name and \
41 self.values == other.values and \
42 self.index == other.index:
43 return True
44 return False
45
48
50 values_str = ''
51 for value in self.values:
52 values_str += value + ','
53 return values_str[:-1]
54
57 self.data = attributes
58
60 if len(test_values) != len(self): return False
61 for i in range(len(test_values)):
62 test_value = test_values[i]
63 if self.data[i].is_continuous(): continue
64 if not self.data[i].has_value(test_value): return False
65 return True
66
72
78
82
90
97