Git Product home page Git Product logo

imageqa-qgen's Introduction

A Question Generator

Usage

python question_generator.py -parser_path {Stanford parser path} \
                             -sentence {Single sentence} \
                             -list {List of sentences file} \
                             -parsed_file {Parsed file} \
                             -output {Output file}

Prerequisites

  1. You need to download NLTK WordNet package.
python
import nltk
nltk.download()
d
wordnet
  1. You need to download Stanford Parser at http://nlp.stanford.edu/software/lex-parser.shtml#Download

  2. Extract the zip into a folder and remember the path

  3. You need to copy lexparser_sentence.sh into the Stanford Parser folder.

cp lexparser_sentence.sh stanford-parser/lexparser_sentence.sh

Examples

Run a single sentence

python question_generator.py -sentence "A man is riding a horse"

Run a list of sentences

  • Provide a file with each line in the file to be a sentence.
  • Output is a pickle file, storing a list.
  • Each element in the list is a tuple of five fields:
    1. Original sentence ID (0-based)
    2. Original sentence
    3. Generated question
    4. Answer to the generated question
    5. Type of the generated question
python question_generator.py -list sentences.txt -output questions.pkl

Run a pre-parsed file

Run stanford parser to pre-compute the parse trees.

lexparser.sh sentences.txt > sentences_parsed.txt
python question_generator.py -parsed_file sentences_parsed.txt \
                             -output questions.pkl

Reference

Exploring Models and Data for Image Question Answering. Mengye Ren, Ryan Kiros, Richard Zemel. NIPS, 2015.

@inproceedings{ren2015imageqa,
  title={Exploring Models and Data for Image Question Answering},
  author={Mengye Ren and Ryan Kiros and Richard Zemel},
  booktitle={NIPS},
  year={2015}
}

imageqa-qgen's People

Contributors

renmengye avatar

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.