from statistics import mean import preprocess.orchid_corpus as orchid_corpus import preprocess.sentence as _sentence import choices.wordnet.wn_tree as wn_tree import choices.word_item as _word_item import ast wn = wn_tree.wordnet_tree() orchid = orchid_corpus.orchid_corpus() class question_item: def __init__(self, *args, **kwargs): if len(args) == 5: (sentence, sentence_no, question, answer, answer_index) = args self.sentence = sentence self.sentence_no = sentence_no self.question = question self.answer = answer self.answer_index = answer_index self.choices = None self.asked_choices = None elif "from_str" in kwargs: attributes = ast.literal_eval(kwargs["from_str"]) for key in attributes: if key == "sentence": self.sentence = _sentence.sentence(from_str=attributes["sentence"]) elif key == "choices": self.choices = [_word_item.word_item(from_str=choice_str) for choice_str in attributes["choices"]]
def __init__(self): self.wn = wn_tree.wordnet_tree() self.trans = translator.translator() self.custom_dict = dict()