Skip to content
Snippets Groups Projects
Commit 0d6ab195 authored by Damian Raczkowski's avatar Damian Raczkowski
Browse files

Satisfy pep8

parent 8ac6f7c2
No related branches found
No related tags found
1 merge request!5Develop
Pipeline #14501 passed
......@@ -93,8 +93,8 @@ class W2vWorker(lex_ws.LexWorker):
def _evaluate_operation(self, operation_type, input_to_evaluate):
"""Evaluates operation passed by task.
:param operation_type: task which is supposed to be done. Can be one of either:
vector, similarity, kbest.
:param operation_type: task which is supposed to be done.
Can be one of either: vector, similarity, kbest.
:type operation_type: str
:raise Exception: If provided operation is not supported.
:param input_to_evaluate: Data to be evaluated by the worker.
......@@ -106,8 +106,10 @@ class W2vWorker(lex_ws.LexWorker):
if operation_type == "notmatch":
return model.most_not_match(input_to_evaluate["options"]["words"])
if operation_type == "kbestposneg":
return model.most_similar_full(input_to_evaluate["options"]["positive"],
input_to_evaluate["options"]["negative"])
return model.most_similar_full(
input_to_evaluate["options"]["positive"],
input_to_evaluate["options"]["negative"]
)
if operation_type == "kbest":
return model.most_similar(input_to_evaluate["lexeme"])
elif operation_type == "similarity":
......@@ -121,12 +123,18 @@ class W2vWorker(lex_ws.LexWorker):
input_to_evaluate["lexeme2"]
)
elif operation_type == "doc2vec":
return model.doc2vec(input_to_evaluate["lexeme1"], input_to_evaluate["counts1"])
return model.doc2vec(
input_to_evaluate["lexeme1"],
input_to_evaluate["counts1"]
)
elif operation_type == "vector":
return model.vector_representations(input_to_evaluate["lexeme"])
elif operation_type == "all" or not operation_type:
return {"vector": model.vector_representations(input_to_evaluate["lexeme"]),
"kbest": model.most_similar(input_to_evaluate["lexeme"])}
return {
"vector": model.vector_representations(
input_to_evaluate["lexeme"]),
"kbest": model.most_similar(input_to_evaluate["lexeme"])
}
else:
raise Exception(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment