Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def generate_and_solve_query13():
- name_to_var = {}
- name_to_var['Southee'] = 'r1'
- name_to_var['Ryder'] = 'r2'
- c1=get_series_catches('Southee')
- c2=get_series_catches('Ryder')
- temp_strin1=''
- for i in name_to_var:
- temp_strin1 += i+' => '+name_to_var[i]+'\n'
- if c1 > c2:
- c2 = c1
- temp_strin2 = 'southee => {'+str(c1)+'} \n'
- temp_strin3 = 'ryder => {'+str(c2)+'} \n'
- v = temp_strin1+temp_strin2+temp_strin3
- query = 'exists x ( southee(x) & ryder(x) )'
- val = nltk.parse_valuation(v)
- dom = val.domain
- m = nltk.Model(dom, val)
- g = nltk.Assignment(dom, [])
- return m.evaluate(query, g)
- def get_series_catches(name):
- c=0
- for i in bat1:
- if bat1[i][0].split()[0] == 'c':
- if bat1[i][0].split()[1]==name:
- c+=1
- elif bat1[i][0].split()[1]=='&' and bat1[i][0].split()[3]==name:
- c+=1
- for i in bat2:
- if bat2[i][0].split()[0] == 'c':
- if bat2[i][0].split()[1]==name:
- c+=1
- elif bat2[i][0].split()[1]=='&' and bat2[i][0].split()[3]==name:
- c+=1
- for i in bat3:
- if bat3[i][0].split()[0] == 'c':
- if bat3[i][0].split()[1]==name:
- c+=1
- elif bat3[i][0].split()[1]=='&' and bat3[i][0].split()[3]==name:
- c+=1
- for i in bat4:
- if bat4[i][0].split()[0] == 'c':
- if bat4[i][0].split()[1]==name:
- c+=1
- elif bat4[i][0].split()[1]=='&' and bat4[i][0].split()[3]==name:
- c+=1
- for i in bat5:
- if bat5[i][0].split()[0] == 'c':
- if bat5[i][0].split()[1]==name:
- c+=1
- elif bat5[i][0].split()[1]=='&' and bat5[i][0].split()[3]==name:
- c+=1
- return c
Advertisement
Add Comment
Please, Sign In to add comment