def filter_rec(func, iterable): ret = [] for item in iterable: if type(item) == list: ret.append(Utils.filter_rec(func, item)) else: if func(item): ret.append(item) return ret
def filter_words(words): return Utils.filter_rec( lambda x: x.split('_')[-1] in LdaUtils.NECESSARIES, words)
def filter_words(words): return Utils.filter_rec(lambda x: x.split('_')[-1] in LdaUtils.NECESSARIES, words)