Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- l = []
- labels = []
- farm = ['agriculture','maize','food','wheat','corn','cotton','grain','soybeans','agricultural']
- oil = ['oil','petroleum', 'barrel','fuel','gas','energy']
- x=0
- y=0
- t=0
- word = []
- f = open('train_set.txt')
- for line in f:
- for i in line.split():
- word.append(i)
- for j in farm:
- if j in word:
- x=x+1
- for k in oil:
- if k in word:
- y=y+1
- if x>y:
- l.append('1')
- else:
- l.append('0')
- word=[]
- x=0
- y=0
- f = open('train_set.txt')
- for line in f:
- labels.append(line[0])
- print labels
- print l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement