def n_gram(s, n):
    return [s[i:i+n] for i in range(len(s)-1)]

s = "I am an NLPer"
print('文字bi-gram: {}'.format(n_gram(s, 2)))
s = s.split()
print('単語bi-gram: {}'.format(n_gram(s, 2)))

4aa098794215494c731ee7cd2a85085671f1eced
<mask token>

def n_gram(s, n):
    return [s[i:i + n] for i in range(len(s) - 1)]


<mask token>

def n_gram(s, n):
    return [s[i:i + n] for i in range(len(s) - 1)]


<mask token>
print('文字bi-gram: {}'.format(n_gram(s, 2)))
<mask token>
print('単語bi-gram: {}'.format(n_gram(s, 2)))

def n_gram(s, n):
    return [s[i:i + n] for i in range(len(s) - 1)]


s = 'I am an NLPer'
print('文字bi-gram: {}'.format(n_gram(s, 2)))
s = s.split()
print('単語bi-gram: {}'.format(n_gram(s, 2)))

def n_gram(s, n):
    return [s[i:i+n] for i in range(len(s)-1)]

s = "I am an NLPer"
print('文字bi-gram: {}'.format(n_gram(s, 2)))
s = s.split()
print('単語bi-gram: {}'.format(n_gram(s, 2)))
