1 import string
2 import sys
3
4
6 if exist == 1:
7 for action in actions:
8 if action.find(c) > -1:
9 return 1
10 return 0
11 else:
12 found = 0
13 for action in actions:
14 if action.find(c) > -1:
15 found = 1
16 break
17
18 if found == 1:
19 return 0
20 else:
21 return 1
22
23
24
25
26
27
28 -def selectReport(path,actor,criteria={'hunter-kill-wolf':'0'}):
74
76 fileHandle = open (f1)
77
78 pathList1 = fileHandle.readlines()
79
80 fileHandle.close()
81
82 fileHandle = open (f2)
83
84 pathList2 = fileHandle.readlines()
85
86 fileHandle.close()
87
88 diff1 = []
89 diff2 = []
90
91 for path in pathList1:
92 if path[0] == '[':
93 if not path in pathList2:
94 diff1.append(path)
95
96 for path in pathList2:
97 if path[0] == '[':
98 if not path in pathList1:
99 diff2.append(path)
100
101
102 print 'path in file ',f1,' but not in file ',f2
103 print 'totle number: ',len(diff1)
104
105 print 'path in file ',f2,' but not in file ',f1
106 print 'totle number: ',len(diff2)
107
108 for i in range(len(diff1)):
109 print diff1[i]
110
111
112
113 -def printResult(totalRecord,distinctRecord,reportList,report):
114 print "Total numbers of record in file: ",totalRecord
115 print "Total numbers of distinct record in file: ",distinctRecord
116 print "Number of record prompt for attention: ",len(reportList)
117 print "Number of record selected by default huristics: ", report[4]
118 print report[1],report[2]
119 print "Number of record selected by plot point: ", report[3]
120 print "Number of record satisfy all filtering criteria: ", report[0]
121 print
122 print
123
125 totalList = []
126 reportList = []
127
128 for fname in fnames:
129 fileHandle = open (fname)
130
131 pathList = fileHandle.readlines()
132
133 fileHandle.close()
134
135 reportList = []
136
137 totalRecord = 0
138
139 distinctRecord = 0
140
141 criteria={'hunter-kill-wolf':'0','wolf-eat-granny':'1'}
142
143 i = 0
144
145 report = [0]*5
146 d = 0
147 for path in pathList:
148 if path.find('red')==0:
149 printResult(totalRecord,distinctRecord,reportList,report)
150 print path
151 totalRecord = 0
152 distinctRecord = 0
153 report = [0]*5
154 reportList = []
155 d = pathList.index(path)
156 elif path[0] == '[':
157 totalRecord += 1
158 if pathList[d+1:].index(path) + d + 1 == i:
159 distinctRecord += 1
160 res = selectReport(path,'wolf',criteria)
161 if not 0 in res:
162 if not path in reportList:
163 reportList.append(path)
164 if 1 in res:
165 report[1]+=1
166 if 2 in res:
167 report[2]+=1
168 if 3 in res:
169 report[3]+=1
170 if (1 in res) and (2 in res) and (3 in res):
171 report[0]+=1
172 if (1 in res) or (2 in res):
173 report[4]+=1
174
175 i += 1
176 printResult(totalRecord,distinctRecord,reportList,report)
177
178
179
180
181
182
183
184
185 if __name__ == '__main__':
186
187
188
189
190
191
192
193
194
195
196 ProcessResults(['result-0426-good-wolf-boston-fin.txt','0426result-phrygian-bad-wolf-depth-2-phrygian.txt'])
197 ProcessResults(['result-0429-varygoal-2-depth-boston.txt'])
198 ProcessResults(['0428-vary-goal-bad-wolf.txt'])
199