ans = []
text = ['cant railway station', 'citadel hotel', ' police stn']
for line in text:
    arr = line.split()
for i in range(len(arr)):
    if i < len(arr) - 1:
        ans.append([[arr[i]], [arr[i + 1]]])
print(ans)
Forming Bigrams of words in list of sentences with Python