Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from textblob import TextBlob
- with open('Diners.txt','r') as file:
- text = file.read()
- blob = TextBlob(text)
- adjectives = []
- nouns = []
- for word,pos in blob.tags:
- print(word,pos)
- if (pos == 'JJ'):
- adjectives.append(word)
- if (pos == 'NN'):
- nouns.append(word)
- for i in range(8):
- a = random.choice(adjectives)
- n = random.choice(nouns)
- print(a,n)
Add Comment
Please, Sign In to add comment