Guest User

Untitled

a guest
Sep 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import random
  2. from textblob import TextBlob
  3. with open('Diners.txt','r') as file:
  4. text = file.read()
  5. blob = TextBlob(text)
  6. adjectives = []
  7. nouns = []
  8. for word,pos in blob.tags:
  9. print(word,pos)
  10. if (pos == 'JJ'):
  11. adjectives.append(word)
  12. if (pos == 'NN'):
  13. nouns.append(word)
  14. for i in range(8):
  15. a = random.choice(adjectives)
  16. n = random.choice(nouns)
  17. print(a,n)
Add Comment
Please, Sign In to add comment