def combos(multilist): """ given a list of lists, return all flattened lists""" if len(multilist) == 0: return [""] else: return [ normalize_text(head + " " + tail) for head in multilist[0] for tail in combos(multilist[1:]) ]
def add_prefix(prefix): subs = t.suffixes(normalize_text(prefix).split(" ")) for sub in subs: stxt = " ".join(sub) prefix_counts[stxt] = prefix_counts.get(stxt,0) + 1
def combos(multilist): """ given a list of lists, return all flattened lists""" if len(multilist) == 0: return [""] else: return [normalize_text(head + " " + tail) for head in multilist[0] for tail in combos(multilist[1:])]
def add_prefix(prefix): subs = t.suffixes(normalize_text(prefix).split(" ")) for sub in subs: stxt = " ".join(sub) prefix_counts[stxt] = prefix_counts.get(stxt, 0) + 1