Пример #1
0
 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
Пример #2
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]] = []
Пример #3
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]]=[]
Пример #4
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
Пример #6
0
 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):
     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
Пример #8
0
	def validate(self,tweet):
		cleaned = wordtools.clean(tweet)
		if wordtools.validate(cleaned) and len(cleaned)>=2:
			return cleaned
		else:
			return None
Пример #9
0
	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
Пример #10
0
	def validate(self,tweet):
		cleaned = wordtools.clean(tweet)
		if wordtools.validate(cleaned):
			return [cleaned,tweet]
Пример #11
0
 def validate(self, tweet):
     cleaned = wordtools.clean(tweet)
     if wordtools.validate(cleaned):
         return [cleaned, tweet]
Пример #12
0
 def validate(self, tweet):
     cleaned = wordtools.clean(tweet)
     if wordtools.validate(cleaned) and len(cleaned) >= 2:
         return cleaned
     else:
         return None