def validate(self, tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned) > 0: return [ ''.join(c for c in self.letters if c in tweet.upper()), tweet ] else: return None
def readTweet(self, tweet): cleaned = wordtools.clean(tweet) if not wordtools.validate(cleaned) or not len(cleaned) > 0: return if cleaned[0] in self.data[0]: self.data[0][cleaned[0]].append(tweet) else: self.data[0][cleaned[0]] = [tweet] if len(self.data[0][cleaned[0]]) == 4: self.data[1] = self.data[0][cleaned[0]] self.data[0][cleaned[0]] = []
def readTweet(self, tweet): cleaned = wordtools.clean(tweet) if not wordtools.validate(cleaned) or not len(cleaned)>0: return if cleaned[0] in self.data[0]: self.data[0][cleaned[0]].append(tweet) else: self.data[0][cleaned[0]]=[tweet] if len(self.data[0][cleaned[0]])==4: self.data[1] = self.data[0][cleaned[0]] self.data[0][cleaned[0]]=[]
def validate(self, tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned): sounds = [] for word in cleaned: sounds += wordtools.getPronunciationNoStress(word) + [" "] if len(sounds) > 4: sounds.pop() # remove the last space return sounds else: return None else: return None
def validate(self, tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned): sounds = [] for word in cleaned: sounds += wordtools.getPronunciationNoStress(word) + [" "] if len(sounds) > 4: sounds.pop() #remove the last space return sounds else: return None else: return None
def validate(self, tweet): clean = wordtools.clean(tweet) if not wordtools.validate(clean): return None initials = {} for i in range(len(clean)): initial = wordtools.getInitialSound(clean[i]) if initial in initials: initials[initial][0] += 1 else: initials[initial] = [1, False, False] if i < len(clean) / 2: initials[initial][1] = True else: initials[initial][2] = True if len(initials) == 0: return None if self.existsUsableSound(initials, len(clean) * self.ALLITERATIVE_FACTOR): return tweet else: return None
def validate(self,tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned)>=2: return cleaned else: return None
def validate(self,tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned)>0: return [''.join(c for c in self.letters if c in tweet.upper()),tweet] else: return None
def validate(self,tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned): return [cleaned,tweet]
def validate(self, tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned): return [cleaned, tweet]
def validate(self, tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned) >= 2: return cleaned else: return None