Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. l = []
  2. labels = []
  3. farm = ['agriculture','maize','food','wheat','corn','cotton','grain','soybeans','agricultural']
  4. oil = ['oil','petroleum', 'barrel','fuel','gas','energy']
  5. x=0
  6. y=0
  7. t=0
  8. word = []
  9.  
  10. f = open('train_set.txt')
  11. for line in f:
  12. for i in line.split():
  13. word.append(i)
  14. for j in farm:
  15. if j in word:
  16. x=x+1
  17. for k in oil:
  18. if k in word:
  19. y=y+1
  20.  
  21. if x>y:
  22. l.append('1')
  23. else:
  24. l.append('0')
  25. word=[]
  26. x=0
  27. y=0
  28.  
  29. f = open('train_set.txt')
  30. for line in f:
  31. labels.append(line[0])
  32.  
  33. print labels
  34. print l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement