#!/usr/bin/env python
from __future__ import print_function

from argparse import ArgumentParser, RawTextHelpFormatter as RawText

from ewbst import WbstQuestionGenerator

def run(graph, words, depth):
    generator = WbstQuestionGenerator(graph, graph_depth=depth)
    with open(words) as file_:
        words = [line.strip() for line in file_]
    for word in words:
        for question in generator.generate_questions_for_word(word):
            print(question.to_csv())

def _main():
    args = _get_args()
    run(**vars(args))

def _get_args():
    parser = ArgumentParser(description=__doc__, formatter_class=RawText)
    parser.add_argument("-g", "--graph", required=True, help="Graph file")
    parser.add_argument("-w", "--words", required=True, help="Words")
    parser.add_argument("--depth", type=int, help="Graph depth")
    return parser.parse_args()

if __name__ == "__main__":
    _main()

