Example #1
0
def reason_with_pytalk_FromText(text, qlist):
    params = talk_params()
    params.with_answerer = True
    params.answers_by_rank = True
    params.to_prolog = 1
    talkans, thinkans = reason_with_Text(text, qlist, params)
    return talkans, thinkans
Example #2
0
def pdf_test():
    d = '{"quiet" : true}'
    fname = 'pdfs/cloudmis.pdf'
    #t = Talker(from_pdf=fname,params=talk_params(from_json=d))
    #t.show_all()
    fname = 'pdfs/cloudmis.txt'
    t = Talker(from_file=fname, params=talk_params(from_json=d))
    t.show_all()
Example #3
0
def runWithTextAlt(fname, wk, sk, filter):
    params = talk_params()
    params.top_sum = sk
    params.max_sum = params.top_sum * (params.top_sum - 1) / 2
    params.top_keys = wk
    params.max_keys = 1 + 2 * params.top_keys
    talker = Talker(from_file=fname, params=params)
    ranked_sents = talker.get_summary()
    keys = talker.get_keys()

    def clean_sents():
        for r, s, ws in ranked_sents:
            yield ws

    #print('!!!KEYS',keys)
    #print('!!!SENT',list(clean_sents()))
    keys = nice_keys(keys)
    return (keys, clean_sents(), talker.g.number_of_nodes(),
            talker.g.number_of_edges())
Example #4
0
def reason_with_pytalk_FromFile(fname):
    params = talk_params()
    params.with_answerer = True
    params.answers_by_rank = True
    params.to_prolog = 1
    talkans, thinkans = reason_with_File(fname, params)
    return talkans, thinkans

    for article in dataset['data']:
        for i, paragraph in enumerate(article['paragraphs']):
            fname = "dev/" + article['title'] + "_" + str(i) + ".txt"
            conext = paragraph['context']
            with wopen(fname) as fcontext:
                fcontext.write(conext + "\n")
            fcontext.close()
            questions = paragraph['qas']
            fqname = "dev/" + article['title'] + "_" + str(i) + "_quest.txt"
            with wopen(fqname) as fquest:
                for question in questions:
                    q = question['question']
                    fquest.write(q + "\n")
                fquest.close()
Example #5
0
def jtest():
    d = '{"quiet" : false}'
    fname = 'examples/test.txt'
    t = Talker(from_file=fname, params=talk_params(from_json=d))
    t.show_all()
Example #6
0
def qtest():
    d = {"quiet": False}
    fname = 'examples/test.txt'
    t = Talker(from_file=fname, params=talk_params(from_dict=d))
    t.show_all()