Deu certo tanto no Jupyter quanto no Colab!!
!pip install nltk==3.6.2
import nltk
nltk.download('all')
nltk.__version__
from nltk.util import pad_sequence
from nltk.util import bigrams
from nltk.util import ngrams
from nltk.lm.preprocessing import pad_both_ends
from nltk.util import pad_sequence
list(pad_sequence(texto_teste,
pad_left=True, left_pad_symbol="<s>",
pad_right=True, right_pad_symbol="</s>",
n=2)) # The n order of n-grams, if it's 2-grams, you pad once, 3-grams pad twice, etc.
padded_sent = list(pad_sequence(texto_teste, pad_left=True, left_pad_symbol="<s>",
pad_right=True, right_pad_symbol="</s>", n=2))
list(ngrams(padded_sent, n=2))
Cheguei ao mesmo resultado: [('', 'a'), ('a', 'l'), ('l', 'u'), ('u', 'r'), ('r', 'a'), ('a', '')]