def ngrams(items, n=2):
    """Return all n-length slices of items in order."""
    starts = [i for i in range(0, max(0, len(items)-n))]
    ends = [j for j in range(min(n, len(items)), len(items))]
    return [items[i:j] for i, j in zip(starts, ends)]