Estefani Gaytan Nunez

upload

...@@ -180,7 +180,7 @@ if __name__ == "__main__": ...@@ -180,7 +180,7 @@ if __name__ == "__main__":
180 else: 180 else:
181 outputLine = line.split(' ')[0] 181 outputLine = line.split(' ')[0]
182 # Saving Sentence Ouput I 182 # Saving Sentence Ouput I
183 - print(outputLine) 183 + #print(outputLine)
184 sentencesOutputDataI.append(idx[lidx].replace('\n','\t') + outputLine + '\t' + ', '.join(Ltags)) 184 sentencesOutputDataI.append(idx[lidx].replace('\n','\t') + outputLine + '\t' + ', '.join(Ltags))
185 # Increase sentence counter 185 # Increase sentence counter
186 lidx += 1 186 lidx += 1
...@@ -215,7 +215,7 @@ if __name__ == "__main__": ...@@ -215,7 +215,7 @@ if __name__ == "__main__":
215 outputLine += word.split('|')[0] + ' ' 215 outputLine += word.split('|')[0] + ' '
216 i += 1 216 i += 1
217 # Saving Sentence Ouput I 217 # Saving Sentence Ouput I
218 - print(outputLine) 218 + #print(outputLine)
219 sentencesOutputDataI.append(idx[lidx].replace('\n', '\t') + outputLine+ '\t' +', '.join(Ltags)) 219 sentencesOutputDataI.append(idx[lidx].replace('\n', '\t') + outputLine+ '\t' +', '.join(Ltags))
220 lidx += 1 220 lidx += 1
221 221
...@@ -226,16 +226,16 @@ if __name__ == "__main__": ...@@ -226,16 +226,16 @@ if __name__ == "__main__":
226 for line in sentencesOutputDataI: 226 for line in sentencesOutputDataI:
227 if re.findall('</', line): 227 if re.findall('</', line):
228 #print(line) 228 #print(line)
229 - oline = line.replace('LDR','(') 229 + oline = line.replace('-LRB-','(')
230 - oline = oline.replace('RDR',')') 230 + oline = oline.replace('-RRB-',')')
231 oFileI.write(oline + '\n') 231 oFileI.write(oline + '\n')
232 232
233 ########################################### Save Output II ########################################## 233 ########################################### Save Output II ##########################################
234 print("Saving Ouput II...") 234 print("Saving Ouput II...")
235 with open(os.path.join(options.outputPath, options.outFileII + '_' + options.modelName + '.tsv'), "w") as oFileII: 235 with open(os.path.join(options.outputPath, options.outFileII + '_' + options.modelName + '.tsv'), "w") as oFileII:
236 for line in sentencesOutputDataI: 236 for line in sentencesOutputDataI:
237 - oline = line.replace('LDR','(') 237 + oline = line.replace('-LRB-','(')
238 - oline = oline.replace('RDR',')') 238 + oline = oline.replace('-RRB-',')')
239 for ttex, tag in re.findall(r'<[^>]+>([^<]+)</([^>]+)>', oline): 239 for ttex, tag in re.findall(r'<[^>]+>([^<]+)</([^>]+)>', oline):
240 lline = oline.split('\t')[0:-2] + [ttex, tag] 240 lline = oline.split('\t')[0:-2] + [ttex, tag]
241 nline = '\t'.join(lline) 241 nline = '\t'.join(lline)
...@@ -245,7 +245,7 @@ if __name__ == "__main__": ...@@ -245,7 +245,7 @@ if __name__ == "__main__":
245 print("Saving Ouput III...") 245 print("Saving Ouput III...")
246 with open(os.path.join(options.outputPath, options.outFileIII + '_' + options.modelName + '.tsv'), "w") as oFileIII: 246 with open(os.path.join(options.outputPath, options.outFileIII + '_' + options.modelName + '.tsv'), "w") as oFileIII:
247 for line, tagLine in zip(lines, y_pred): 247 for line, tagLine in zip(lines, y_pred):
248 - oline = [ w.split('|')[0].replace('LDR','(').replace('LDR','(')+'|'+tag for w,tag in zip(line.split(' '), tagLine)] 248 + oline = [ w.split('|')[0].replace('-LRB-','(').replace('-LRB-','(')+'|'+tag for w,tag in zip(line.split(' '), tagLine)]
249 249
250 oFileIII.write(' '.join(oline) + '\n') 250 oFileIII.write(' '.join(oline) + '\n')
251 251
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.