huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
132.05k stars 26.3k forks source link

NLQ application #3899

Closed thiagomoeng closed 4 years ago

thiagomoeng commented 4 years ago

❓ Questions & Help

I have a pdf extractor and from this I got a dataframe with 2 columns (sections,paragraphs). Is there any easy way to do a question and get answer like: (example) Question: "where is the book?" Answer: "It's on the bookshelf." Section: "1.2.3 The Book" Paragraph: "(Full section paragraph)"

Sorry for bad english.

AlecS12 commented 4 years ago

I assume you concatenate all paragraphs in a single text string, encode it with your question, and give the string as an input to your QA model (or pipeline). What you get back, is an answer span: indexes of the first and last character of the answer in the input text. To find a paragraph it belongs to, compute indexes of the paragraph spans in your concatenated text strings.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.