Skip to content

Extractive QA with multiple answers #406

@SamPse

Description

@SamPse

Hello, I am new to txtai and I want to know if I can have a list of results with the QA approach.

My code is:

context = ["The doctor administered a 7g dose of Acetarsol and a 16mg dose of Ibuprofen",
           "The patient took one Alosetron tablet"]


queries = ["What is the drug taken?", "What is the dose?"]

questions = Questions(path=("sultan/BioM-ELECTRA-Large-SQuAD2-BioASQ8B", tokenizer), gpu=True)
results = [questions([question] * len(context), context) for question in queries]
results.append(context)

pd.DataFrame(list(zip(*results)), columns=["Drug", "Dose", "Text"])

I would like to have this result.

Drug Dose Text
Acetarsol 7g The doctor administered a 7g dose of Acetarsol and a 16mg dose of Ibuprofen
Ibuprofen 16mg The doctor administered a 7g dose of Acetarsol and a 16mg dose of Ibuprofen
Alosetron None The patient took one Alosetron tablet

thank you for your help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions