Carlos-Francisco Méndez-Cruz

Conditional Random Fields

...@@ -256,14 +256,14 @@ if __name__ == "__main__": ...@@ -256,14 +256,14 @@ if __name__ == "__main__":
256 print("*********************************") 256 print("*********************************")
257 name = options.trainingFile.replace('.txt', '.fStopWords_' + str(options.excludeStopWords) + '.fSymbols_' + str( 257 name = options.trainingFile.replace('.txt', '.fStopWords_' + str(options.excludeStopWords) + '.fSymbols_' + str(
258 options.excludeSymbols) + '.txt') 258 options.excludeSymbols) + '.txt')
259 - with open(os.path.join(options.outputPath, "reports-lp", "y_pred_" + name), "w") as oFile: 259 + with open(os.path.join(options.outputPath, "reports", "y_pred_" + name), "w") as oFile:
260 for y in y_pred: 260 for y in y_pred:
261 oFile.write(str(y) + '\n') 261 oFile.write(str(y) + '\n')
262 262
263 print("*********************************") 263 print("*********************************")
264 name = options.trainingFile.replace('.txt', '.fStopWords_' + str(options.excludeStopWords) + '.fSymbols_' + str( 264 name = options.trainingFile.replace('.txt', '.fStopWords_' + str(options.excludeStopWords) + '.fSymbols_' + str(
265 options.excludeSymbols) + '.txt') 265 options.excludeSymbols) + '.txt')
266 - with open(os.path.join(options.outputPath, "reports-lp", "y_test_" + name), "w") as oFile: 266 + with open(os.path.join(options.outputPath, "reports", "y_test_" + name), "w") as oFile:
267 for y in y_test: 267 for y in y_test:
268 oFile.write(str(y) + '\n') 268 oFile.write(str(y) + '\n')
269 269
...@@ -272,7 +272,7 @@ if __name__ == "__main__": ...@@ -272,7 +272,7 @@ if __name__ == "__main__":
272 # labels = list(crf.classes_) 272 # labels = list(crf.classes_)
273 # labels.remove('O') 273 # labels.remove('O')
274 274
275 - with open(os.path.join(options.outputPath, "reports-lp", "report_" + nameReport), mode="a") as oFile: 275 + with open(os.path.join(options.outputPath, "reports", "report_" + nameReport), mode="a") as oFile:
276 oFile.write('\n********** EVALUATION **********\n') 276 oFile.write('\n********** EVALUATION **********\n')
277 oFile.write("Flat F1: " + str(metrics.flat_f1_score(y_test, y_pred, average='weighted', labels=labels))) 277 oFile.write("Flat F1: " + str(metrics.flat_f1_score(y_test, y_pred, average='weighted', labels=labels)))
278 oFile.write('\n') 278 oFile.write('\n')
......