Bigrams
Python
sentence = """
Have free hours and love children?
Drive kids to school, soccer practice
and other activities.
"""
def get_bigrams(sentence):
words = sentence.split(' ')
words = [word.replace('\n', '').lower() for word in words]
return [(first, second) for first, second in zip(words, words[1:])]
print(get_bigrams(sentence))
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.