Skip to content

erkanay/polyglot-quiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

polyglot-quiz

It helps *lazy linguistics to generate simple questionaries for any purposes.

Basically, it takes a text in any language then produce number of questions by given grammar subject.

Installation

$ git clone https://github.com/erkanay/polyglot-quiz.git
$ cd polyglot-quiz
$ pip install -r requirements.txt
$ python test.py

Usage

>>> from quiz import PolyglotQuiz

>>> text = open('anystory.txt', 'rt').read()
>>> # IN --> Preposition or subordinating conjunction
>>> polyglot = PolyglotQuiz(text, _type='IN', regexp=r'\w+')
>>> polyglot.generate_quiz()
Q.1) Cinderella, who saw all this, and
knew her slipper, said to them, laughing:
"Let me see ___ it will not fit me."

    a) out  b) if  c) unknown  d) among
    
Q.2) They threw themselves at her feet to beg pardon ___ all the
ill-treatment they had made her undergo.

    a) for  b) As  c) without  d) behind

Q.3) The guards ___ the palace gate were asked: 
If they had not seen a princess go out.

    a) at  b) after  c) appear  d) among
    
...

A.1) if  A.2) for  A.3) at

...

Please see full list of part of speech tags to generate different types of questionaries:

http://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html

Or learn more details about tags by following method:

>>> polyglot.read_manual()

*note: thanks to NLTK.

About

polyglot-quiz generates simple questionaries for linguistics.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages