Skip to content
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

Q&A with fixed passage #1

Open
Andredenise opened this issue Apr 8, 2022 · 3 comments
Open

Q&A with fixed passage #1

Andredenise opened this issue Apr 8, 2022 · 3 comments

Comments

@Andredenise
Copy link

Hey, this is an awesome repository! I wanted to make my own q&a web app and this ideal. I was just wondering ifyou could help me to change the code a bit so that you can just ask questions about a fixed text that is also not visible on the web app. More precise that you only have a question box in which you can ask questions about a certain text that is already specified in the code.

Thanks in advance!

@JorgeOchoaReyes
Copy link

To have a fixed text you can just manually set the text in model.findAnswers() to whatever text you want.

const answerQuestion = async (e) => {
  if (e.which === 13 && model !== null ){
    console.log('Question submitted.')
    const question = questionRef.current.value

    const answers = await model.findAnswers(question, __YOURTEXT__)

    setAnswer(answers); 
    console.log(answers)
  }  
}

And then remove textarea and passageRef from the code so that the user only ask questions.

@Amrutha1101
Copy link

This doesn't work with long passages as it works with short ones. How do I create such model?

@JorgeOchoaReyes
Copy link

JorgeOchoaReyes commented Apr 16, 2023

There is max context you can provide to BERT models.

Here are some alternative approaches you can try to get around it.
https://stackoverflow.com/a/58643108

Some additional info that may be helpful:
google-research/bert#27
https://github.com/mim-solutions/bert_for_longer_texts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants