def splitTags (strTags): if not strTags: return [] strTags = strTags.lower() listWords = list(set(strTags.split(','))) listTags=[] for word in listWords: if word not in STOPWORDS: word = word.lstrip("#") new_word = '' for i in range(len(word)): if valid_latin1(ord(word[i])): new_word = new_word + word[i] listTags.append(new_word) return list(set(listTags))
def validTag(tag): return all(valid_latin1(ord(char)) for char in tag)