Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def get_keywords2(lines):
  2. key_words = []
  3.  
  4. for line in lines:
  5. tokens = line.split()
  6. if len(tokens) != 5 or not re.search('[a-zA-Z]', tokens[0]) == None:
  7. continue
  8. word = tokens[0]
  9. pos_count = tokens[3]
  10. neg_count = tokens[4]
  11. if int(pos_count) != 0:
  12. key_words += [([word],"postive")]* int(pos_count)
  13. if int(neg_count) != 0:
  14. key_words += [([word],"negative")]* int(neg_count)
  15. return key_words
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement