Skip to content

Instantly share code, notes, and snippets.

@kvorion
Created December 7, 2010 05:06
Show Gist options
  • Save kvorion/731482 to your computer and use it in GitHub Desktop.
Save kvorion/731482 to your computer and use it in GitHub Desktop.
getvalues method
def GetValues(self):
file = open(self.trainingFile, 'r')
for line in file:
if line[0] != '@': #start of actual data
self.featureVectors.append(line.strip().lower().split(','))
else: #feature definitions
if line.strip().lower().find('@data') == -1 and (not line.lower().startswith('@relation')):
self.featureNameList.append(line.strip().split()[1])
self.features[self.featureNameList[len(self.featureNameList) - 1]] = line[line.find('{')+1: line.find('}')].strip().split(',')
file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment