def add_to_index(p, name, id): text = name.lower() text = util.remove_accents(text) text = util.remove_punctuation(text) words = text.split() swords = set(words) for word in swords: w = 'si-' + word p.sadd(w, id)
def artist_search(text): lwords = set() text = text.lower() text = util.remove_accents(text) text = util.remove_punctuation(text) words = text.split() swords = set(words) for word in swords: w = 'si-' + word lwords.append(w) aids = r.sinter(lwords) print 'as', lwords, aids return list(aids)
def filter_name(text): text = text.lower() text = util.remove_accents(text) text = util.remove_punctuation(text) return text
def category_without_accents(self): return remove_accents(self.category_trans)
def name_without_accents(self): return remove_accents(self.name_trans)
def get_words(text): splitter = re.compile(r'[\s|\-|\)|\(|/]+') return [s.lower() for s in splitter.split(remove_accents(text)) if s != '']