Code Monkey home page Code Monkey logo

Comments (1)

patil-suraj avatar patil-suraj commented on May 30, 2024 1

Thanks @s20ss.
This is described in this section.

I did this using text-to-text approach. There are two ways we can do this

  1. Provide the context as input and ask the model to generate ans spans separated by sep token.
    So for this example Python is a programming language. Created by Guido Van Rossum and first released in 1991.
    ans could be Python, a programming language, Guido Van Rossum and 1991. So we can process input as follows

input text: Python is a programming language. Created by Guido Van Rossum and first released in 1991.

target text: Python <sep> a programming language <sep> Guido Van Rossum <sep> 1991 <sep>

But there's one problem with this approach. What if a particular answer span is repeated more than once in the context and depending on where it occurs it could be an answer or not, so how can we make the model to understand the position of answer spans.

So the second approach is (which is used in this project) to highlight the sentence which contains answer spans and ask the model to generate answers only for that sentence. In SQuAD we know the start index of of the answers, so here's how it works

  1. split the input into sentences.
  2. If a sentence contains ans spans highlight that sentence and prepare a training example ,and the target will be answer spans in that sentence separated by <sep>

So for above example, we will have 2 input examples as there are two sentences and both of them contain answer spans

so first
input text: <hl> Python is a programming language. <hl> Created by Guido Van Rossum and first released in 1991.
target text: Python <sep> a programming language <sep>

and second
input text: Python is a programming language. <hl> Created by Guido Van Rossum and first released in 1991. <hl>
target text: Guido Van Rossum <sep> 1991 <sep>

the assumption is that, this should force the model to understand the position of the spans. And also for QG, ans spans are highlighted within the context, so we need to know the position of the answer spans. With this approach at inference time we can highlight each sentence, extract ans from that sentence then highlight those answers and ask the model to generate the question.

There's another way to do this, which is using BERT like models. Basically we can model the task of answer extraction as unconditional span extraction. This is described in this paper . I decided to not use this as I wanted to keep everything uniform and as simple as possible.

Hope this helps. ;)

from question_generation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.