dream

Форк
0
/
interactive_test_router.py 
89 строк · 4.6 Кб
1
# flake8: noqa
2
# %%
3
import pprint
4
from router import run_skills as skill
5
import random
6

7
SEED = 31415
8
random.seed(SEED)
9

10
# request_utters = ["t1", "top", "year", "ok", "talk about", "yes", "yes"]
11
# request_utters = ["t1", "top", "year", "ok", "talk about"]
12
request_utters = [
13
    "hi",
14
    "top of week",
15
    "yes",
16
    "go on",
17
    "move on",
18
    "top of last year",
19
    "yes",
20
    "talk",
21
    "yes",
22
    "ten",
23
    "next",
24
    "top of month",
25
    "no",
26
    "top",
27
]
28
true_response_utters = [
29
    "Love games. Got a list of the top released games, wanna discuss it?",
30
    " There were 3 newly released games highly rated in the last week. Do you want to learn more? ",
31
    "The game with the highest rating is Risk of Rain 2. It was released on August 11 2020. It's a combination of Action Shooter & Arcade. 48 percent of people marked Risk of Rain 2 as recommended.  If you want to discuss it in details say I want to talk about it.  Talking about it or going on? ",
32
    "The next game is Ghostrunner. It's Action. 33 percent of people marked Ghostrunner as skip.  Chatting about it or the next one? ",
33
    "The next game is UnderMine. It was released on August 06 2020. It's a combination of Action, Adventure RPG & Indie. 53 percent of people marked UnderMine as recommended.  These are all the games from the past week.  If you want to discuss it in details say I want to talk about it.  Otherwise we can always talk about other things.",
34
    " There were 20 newly released games highly rated in this year. Do you want to learn more? ",
35
    "The game with the highest rating is The Last of Us Part II. It was released on June 19 2020. It's a combination of Action Shooter & Adventure. 72 percent of people marked The Last of Us Part II as exceptional.  If you want to discuss it in details say I want to talk about it.  Discussing it or moving on? ",
36
    "Have you played it before? ",
37
    "So I suppose you liked The Last of Us Part II right? How would you rate the desire to play it again, from 1 to 10?",
38
    "You gave it a really high rating. Your rating is higher than one given by the rest of the players. Most of them rated it at 8.76 points. Well. I'd love to talk about other things but my developer forgot to add them to my memory banks. Please forgive him, he's young and very clever. For now can we please discuss the next game?",
39
    "The next game is DOOM Eternal. It was released on March 20 2020. It's a combination of  Action & Shooter. 59 percent of people marked DOOM Eternal as exceptional.  Discussing it or moving on? ",
40
    " There were 3 newly released games highly rated in the last month. Do you want to learn more? ",
41
    "You can always chat with me about other popular games. What do you want to talk about?",
42
    "Last time we had a conversation about the best games of the last month. For now, I can talk about the most popular games for this or last year, last month, or even the last week (hotties!). Which of these time periods is of interest for you?",
43
]
44

45
# true_response_utters = []
46
# request_utters = []
47

48
response_utters = []
49

50

51
def check(request_utters, response_utters, true_response_utters):
52
    for i, (req, ans, true_ans) in enumerate(zip(request_utters, response_utters, true_response_utters)):
53
        print(1)
54
        if ans != true_ans:
55
            print("=================================================")
56
            print(f"index = {i}: \nreq: {req} \nans : {ans} \nholy: {true_ans}")
57

58

59
state = {}
60
for i in request_utters:
61
    random.seed(SEED + len(response_utters))
62
    response, state = skill([i], state)
63
    # print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++")
64
    # print("///////////////////////////////////////////////////////")
65
    # print(f"test request: {i}")
66
    # print(f"model {response['skill_name']}: {response['text']}")
67
    # print("-------------------------------------------------------")
68
    response_utters.append(response["text"])
69

70
check(request_utters, response_utters, true_response_utters)
71
while True:
72
    req = input("test request: ")
73
    if "#" in req:
74
        if req == "#req":
75
            print(request_utters)
76
        elif req == "#ans":
77
            print(response_utters)
78
        elif req == "#dif":
79
            check(request_utters, response_utters, true_response_utters)
80
        continue
81
    request_utters.append(req)
82
    random.seed(SEED + len(response_utters))
83
    response, state = skill([req], state)
84
    print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++")
85
    print("///////////////////////////////////////////////////////")
86
    print(f"test request: {req}")
87
    print(f"model {response['skill_name']}: {response['text']}")
88
    print("-------------------------------------------------------")
89
    response_utters.append(response["text"])
90

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.