primeqa.qg.models.passage_qg.answer_sampler.AnswerSampler#
- class primeqa.qg.models.passage_qg.answer_sampler.AnswerSampler#
Bases:
object
Class for sampling answer tokens from passage, to be used for PassageQG inference.
Methods
create the input for qg training: If the answers are provided in answers_list, use them.
detect the language of an input passage, used later for identifying the right NER model to use
pick the right NER model to use based on detected language of the passage
- create_qg_input(data_list, num_questions_per_instance=5, answers_list=[], id_list=[])#
create the input for qg training: If the answers are provided in answers_list, use them. Otherwise sampling named entities as possible answers from text passages.
- detect_language(text)#
detect the language of an input passage, used later for identifying the right NER model to use
- get_named_entities(text)#
pick the right NER model to use based on detected language of the passage