Unsophisticated Python Chains
public python v1 · immutabledef into_chains(self, texts, chainlength):# PRECONDITION: texts only contains strings of chainlength or greater words chains = [] for text in texts: shattered = text.split() for index in range(0, len(shattered) - chainlength): chains.append(" ".join(shattered[index:index+chainlength-1]) return chains