File size: 546 Bytes
dcf6f0c
4bed6fd
 
f74ef39
 
dcf6f0c
0fdee06
 
 
 
 
dcf6f0c
 
 
 
 
 
 
34129b5
 
 
f74ef39
 
34129b5
dcf6f0c
4bed6fd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import datetime
import json

BIRTHYEAR = 1952
OTHERBIRTHYEAR = 1984

def get_answer(input, context, engine):

    answer = engine({"question": input, "context": context})

    return answer["answer"]


def get_context():

    now = datetime.datetime.now()

    with open("context.json") as f:
        context = (
            json.load(f)["info"]
            .replace("[YEAR]", str(now.year))
            .replace("[AGE]", str(now.year - BIRTHYEAR))
            .replace("[OTHERAGE]", str(now.year - OTHERBIRTHYEAR))
        )

    return context