-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KBQA extension #1598
KBQA extension #1598
Conversation
log.debug(f"(__call__)answers: {answers}") | ||
if not answers: | ||
answers = ["Not Found" for _ in question_batch] | ||
return answers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What behavior do you expect from model, when chainer's element will return only one argument instead of two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two options: if we want to perform rel ranking in query_generator component, then self.return_answers is true and we output answers, otherwise we output candidate_outputs_batch, template_answers_batch and perform ranking in a separate component of the chainer.
answers = ["Not Found" for _ in question_batch] | ||
return answers | ||
else: | ||
return candidate_outputs_batch, template_answers_batch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't fit "out": ["answers", "answer_ids", "query"]
in kbqa_cq_ru
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
answers variable on 113 line is a tuple of "answers", "answer_ids", "query"
question_tokens = nltk.word_tokenize(question) | ||
rels_scores_dict = {} | ||
for query_info in queries_info: | ||
parsed_query_info = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't needed to be declared here
parsed_query_info["query_triplets"] = query_triplets | ||
parsed_query_info["query_sequence"] = query_sequence | ||
parsed_query_info["rels_from_query"] = rels_from_query | ||
parsed_query_info["answer_ent"] = answer_ent | ||
parsed_query_info["filter_info"] = filter_info | ||
parsed_query_info["order_info"] = order_info | ||
parsed_query_info["rel_types"] = rel_types | ||
parsed_query_info["unk_rels"] = unk_rels | ||
parsed_query_info["return_if_found"] = return_if_found | ||
parsed_query_info["selected_entity_ids"] = selected_entity_ids | ||
parsed_query_info["selected_type_ids"] = selected_type_ids | ||
parsed_query_info["rels"] = rels | ||
parsed_query_info["entities_rel_conn"] = entities_rel_conn | ||
parsed_query_info["entity_combs"] = entity_combs | ||
parsed_query_info["type_combs"] = type_combs | ||
parsed_query_info["rel_combs"] = rel_combs | ||
parsed_query_info["all_combs_list"] = all_combs_list | ||
parsed_queries_info.append(parsed_query_info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since parsed_query_info doesn't modified anywhere before this place, it's better to replace with
parsed_queries_info.append({
"x": x,
"y": y,
... etc
})
|
||
|
||
@register('query_formatter') | ||
class QueryFormatter: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QueryFormatter(Component)
Improvement of models for question answering over knowledge graphs.
Updated:
Added: