def build(self, data = None, attributeSet = None):

		if attributeSet is None:
			# build an attribute set.

			aa = AttributeSet()

			for line in data:
				if line[0] == '@':
					aa.add(Attribute(line[1:].split('\t')))

			return aa

		else:
			# build an example set.

			ee = ExampleSet()

			for line in data:
				if type(line) == type(str()):
					if line[0] == '#':
						ee.add(Example(line[1:], attributeSet))
				elif type(line) == type(ExampleSet()):
					ee.add(line)

			return ee
	def __init__(self, filePath=None):
		self.name		= None
		self.attributes = None
		self.examples   = ExampleSet()

		self.iteration_index = 0
		
		if filePath is not None:
			self.initialize(filePath)
    def build(self, data=None, attributeSet=None):
        """ return an AttributeSet or ExampleSet object
			@param	data: input data; raw (textual) attributes or examples
			@param	attributeSet: AttributeSet object required to create ExampleSet objects
			@return	AttributeSet or ExampleSet objects
		"""
        # Build an AttributeSet object from raw (text) attributes.
        if attributeSet is None:
            attributeSet = AttributeSet()

            for line in data:

                # If the line is prefixed with '@', create an Attribute object and add it to the AttributeSet
                if line[0] == '@':
                    attributeSet.add(Attribute(line[1:].split('\t')))

            return attributeSet

        # Build an ExampleSet object from raw (text) examples and an AttributeSet.
        else:
            exampleSet = ExampleSet()

            # Loop through the data split by newline
            for line in data:

                # If the line is a string, check it is an example (prefixed by '#')
                if type(line) == type(str()):

                    # If the line is an example, create an Example object and add it to the ExampleSet
                    if line[0] == '#':
                        exampleSet.add(Example(line[1:], attributeSet))

                # Commented out for the time being 7/13/2016
                #else:
                #	exampleSet.add(line)

            return exampleSet
	def getExamplesByClass(self, i = None):
		""" return examples with label i """
		return ExampleSet(self.examples.getExamples(i))