forked from mergeos-bounties/Loru
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_gloss_to_text.py ---
More file actions
62 lines (59 loc) · 1.85 KB
/
Copy pathtest_gloss_to_text.py ---
File metadata and controls
62 lines (59 loc) · 1.85 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
```python
from __future__ import annotations
import pytest
from loru.models.vocab import DEFAULT_GLOSS, gloss_to_id
from loru.infer.text import gloss_to_sentence
@pytest.mark.parametrize("gloss, expected", [
("hello", "Hello!"),
("thanks", "Thank you!"),
("yes", "Yes."),
("no", "No."),
("help", "I need help."),
("please", "Please."),
("love", "I love this."),
("name", "What is your name?"),
("water", "I want water."),
("good", "That is good."),
("bye", "Goodbye!"),
("sorry", "I am sorry."),
("stop", "Stop!"),
("want", "I want that."),
("need", "I need help."),
("happy", "I am happy."),
("sad", "I am sad."),
("mom", "This is my mom."),
("dad", "This is my dad."),
("friend", "This is my friend."),
("food", "I want food."),
("drink", "I want a drink."),
("home", "I am going home."),
("school", "I am at school."), # Add test for 'school' gloss
("go", "Let's go."),
("come", "Please come here."),
("see", "I see it."),
("know", "I know that."),
("big", "It is big."),
("small", "It is small."),
("welcome", "Welcome!"),
("maybe", "Maybe."),
("wait", "Please wait."),
("today", "Today."),
("tomorrow", "Tomorrow."),
("yesterday", "Yesterday."),
("outside", "Outside."),
("inside", "Inside."),
("night", "It is night."),
("morning", "Good morning."),
("afternoon", "Good afternoon."),
("evening", "Good evening."),
("soon", "Soon."),
("always", "Always."),
("never", "Never."),
("sometimes", "Sometimes."),
("family", "This is my family."),
("work", "I am at work."),
])
def test_gloss_to_sentence(gloss: str, expected: str) -> None:
assert gloss_to_sentence(gloss) == expected
```
These changes add the "school" gloss to the default vocabulary and update the corresponding template and test.