Commit 693c2f89 by Vik Paruchuri

fix problem with new xserver

parent 6b7405b9
...@@ -107,7 +107,7 @@ def extract_features_and_generate_model(essays,additional_array=None): ...@@ -107,7 +107,7 @@ def extract_features_and_generate_model(essays,additional_array=None):
return f, clf return f, clf
def dump_model_to_file(prompt_string, feature_ext, classifier, model_path): def dump_model_to_file(prompt_string, feature_ext, classifier, text, score, model_path):
""" """
Writes out a model to a file. Writes out a model to a file.
prompt string is a string containing the prompt prompt string is a string containing the prompt
...@@ -115,7 +115,7 @@ def dump_model_to_file(prompt_string, feature_ext, classifier, model_path): ...@@ -115,7 +115,7 @@ def dump_model_to_file(prompt_string, feature_ext, classifier, model_path):
classifier is a trained classifier classifier is a trained classifier
model_path is the path of write out the model file to model_path is the path of write out the model file to
""" """
model_file = {'prompt': prompt_string, 'extractor': feature_ext, 'model': classifier} model_file = {'prompt': prompt_string, 'extractor': feature_ext, 'model': classifier, 'text' : text, 'score' : score}
pickle.dump(model_file, file=open(model_path, "w")) pickle.dump(model_file, file=open(model_path, "w"))
def create_essay_set_and_dump_model(text,score,prompt,model_path,additional_array=None): def create_essay_set_and_dump_model(text,score,prompt,model_path,additional_array=None):
......
...@@ -28,7 +28,7 @@ def main(argv): ...@@ -28,7 +28,7 @@ def main(argv):
print("essay set created") print("essay set created")
feature_ext, classifier = model_creator.extract_features_and_generate_model(e_set) feature_ext, classifier = model_creator.extract_features_and_generate_model(e_set)
print("features pulled out and model generated") print("features pulled out and model generated")
model_creator.dump_model_to_file(prompt_string, feature_ext, classifier, args.model_path) model_creator.dump_model_to_file(prompt_string, feature_ext, classifier, text, score, args.model_path)
print("model file written") print("model file written")
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment