cdQA
cdQA copied to clipboard
Can Predict retrieve additional tuples?
As far as I can see, the result from the predict (See the below example) returns a list of 4 tuples of (answer, title, paragraph, score/logit). Now I was wondering whether it would be possible to have additional paragraph attributes in the output? (For example, paragraph ID). If Yes, can you please provide information on how to get that? Thanks
cdqa_pipeline.predict(query='question')
Hi @simontav
In this PR #332 there is a very very first attempt to retrieve extra columns from CSV. Instead of returning a tuple of 4 values, it returns a dictionary with the original 4 values and the rest of the required data.
You can test it in this way:
cdqa_pipeline.predict(query='question', extra_metadata=['column_1', 'column_2'])
Remember, this is not compatible with the stable version due to the output is not a tuple.
Thanks @rogelio-meza-t for your response.I tried to follow all of the changes that was suggested however, I am getting the below error. Do you know what could be the potential reason for such error?
Thank you so much,
As a temporary solution, I advise you to replace the titles in the dataframe by some sort of index, and to store another table in parallel where for each index you have the metadata you need.
When you run .predict
you can obtain the index from the tuple (at the position 1, which correspond to title
). Then, you can map this index to the corresponding metadata.
thanks @andrelmfarias .
Thanks @rogelio-meza-t for your response.I tried to follow all of the changes that was suggested however, I am getting the below error. Do you know what could be the potential reason for such error?
Thank you so much,
Hi @simontav
I'll check what is happening because I don't know exactly where is the bug.