def clean(self):
        if not self.quiet:
            print
            print "Preprocessing input..."
            print "Raw response:"
            print self.display()
        if not self.quiet:
            print
            print "Cleaning words..."
        current_index = 0
        while current_index < len(self.unit_list):
            word = self.unit_list[current_index].text
            if self.type == "PHONETIC":
                test = (word.startswith(self.letter_or_category) and
                        not word.endswith('-') and
                            '_' not in word and
                        word.lower() in self.english_words)
            elif self.type == "SEMANTIC":
                test = word in self.permissible_words
            if not test:
                self.remove_unit(index = current_index)
            else:
                current_index += 1
        current_index = 0
        finished = False
        while current_index < len(self.unit_list) - 1:
            if stemmer.stem(self.unit_list[current_index].text) == \
                stemmer.stem(self.unit_list[current_index + 1].text):
                self.combine_same_stem_units(index = current_index)
            else:
                current_index += 1
        if self.type == "PHONETIC":
            for unit in self.unit_list:
                word = unit.text
                if word in self.cmudict:
                    phonetic_representation = self.cmudict[word]
                if word not in self.cmudict:
                    phonetic_representation = self.generate_phonetic_representation(word)
                    phonetic_representation = self.modify_phonetic_representation(phonetic_representation)
                unit.phonetic_representation = phonetic_representation
        if not self.quiet:
            print
            print "Cleaned response:"
            print self.display()