This repository has been archived by the owner on Oct 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanother_constants.py
121 lines (112 loc) · 3.33 KB
/
another_constants.py
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import nltk
from nltk import CFG
SORTEN_LIST = ['salami', 'hawaii', 'spinat', 'margaritha', 'margarita', 'margherita', 'funghi']
BELAG_LIST = ['salami', 'tomate', 'ananas', 'schinken', 'käse', 'spinat', 'oliven', 'peperoni', 'peperonis', 'pepperoni']
BODEN_LIST = ['dick', 'dickem', 'dicken', 'dickes', 'normal', 'normalen', 'normalem', 'normales', 'dünn', 'dünnem', 'dünnen', 'dünnes']
PRODUCT_LIST = ['pizza', 'pizzabrötchen', 'calzone']
GRAMMAR = CFG.fromstring("""
S -> MENUE
S -> P M O B
S -> P O M B
S -> P B M O
S -> P B O M
S -> P B O
S -> P O B
S -> P M B
S -> P B M
S -> P O M
S -> P M O
S -> P O
S -> P B
S -> P M
S -> P
S -> PRODUCT
S -> PRODUCT1 ODER PRODUCT2
PRODUCT -> 'pizza'|'pizzabrötchen'|'calzone'
P -> SORTE
SORTE -> 'salami'|'hawaii'|'margaritha'|'spinat'|'margarita'|'margherita'|'spinatpizza'|'funghi'
P -> SORTE PRODUCT
P -> PRODUCT SORTE
M -> 'mit' MBELAG
M -> 'zusätzlich' MBELAG
M -> 'extra' MBELAG
M -> 'mit' M
O -> 'ohne' OBELAG
O -> 'kein' OBELAG
MBELAG -> MBELAG MBELAG
MBELAG -> 'salami'|'schinken'|'ananas'|'tomate'|'peperoni'|'käse'|'spinat'|'oliven'|'peperonis'|'pepperoni'
OBELAG -> OBELAG OBELAG
OBELAG -> 'salami'|'schinken'|'ananas'|'tomate'|'peperoni'|'käse'|'spinat'|'oliven'|'peperonis'|'pepperoni'
B -> 'mit' BODENART
BODENART -> 'dünnem' BODEN|'dickem' BODEN
BODEN -> 'boden'
MENUE -> 'was'|'welche'|'menue'|'menü'
ODER -> 'oder'
PRODUCT1 -> 'pizza'|'pizzabrötchen'|'calzone'
PRODUCT2 -> 'pizza'|'pizzabrötchen'|'calzone'
""")
PARSER = nltk.ChartParser(GRAMMAR)
MENUEGRAMMAR = CFG.fromstring("""
S -> VEG
S -> M
S -> MB
S -> O
S -> NEIN
NEIN -> 'nein'
VEG -> 'vegetarisch'|'vegetarisches'
VEG -> 'fleisch'
M -> 'mit' MB
M -> 'zusätzlich' MB
M -> 'extra' MB
M -> 'mit' M
O -> 'ohne' OB
O -> 'ohne' VEG
O -> 'kein' VEG
O -> 'kein'|'keine' OB
O -> 'kein'|'keine' VEG
MB -> MB MB
MB -> 'salami'|'schinken'|'ananas'|'tomate'|'peperoni'|'käse'|'spinat'|'oliven'|'peperonis'|'pepperoni'
OB -> OB OB
OB -> 'salami'|'schinken'|'ananas'|'tomate'|'peperoni'|'käse'|'spinat'|'oliven'|'peperonis'|'pepperoni'
""")
MENUEPARSER = nltk.ChartParser(MENUEGRAMMAR)
BODENGRAMMAR = CFG.fromstring("""
S -> B
S -> ART
B -> 'mit' ART
ART -> 'dünnem' BODEN|'dickem' BODEN
ART -> 'dünnen' BODEN|'dicken' BODEN
ART -> 'dick'|'dünn'|'dickem'|'dicken'|'dickes'|'normal'|'normalen'|'normalem'|'normales'|'dünnem'|'dünnen'|'dünnes'|'dicker'|'dünner'|'normaler'
BODEN -> 'boden'
""")
BODENPARSER = nltk.ChartParser(BODENGRAMMAR)
ALLESGRAMMAR = CFG.fromstring("""
S -> JA
S -> NEIN
S -> M
S -> MB
S -> O
NEIN -> 'nein'|'nö'|'nee'
JA -> 'ja'|'jo'|'jep'
M -> 'mit' MB
M -> 'zusätzlich' MB
M -> 'extra' MB
M -> 'mit' M
O -> 'ohne' OB
O -> 'ohne' VEG
O -> 'kein' OB
O -> 'kein' VEG
MB -> MB MB
MB -> 'salami'|'schinken'|'ananas'|'tomate'|'peperoni'|'käse'|'spinat'|'oliven'|'peperonis'|'pepperoni'
OB -> OB OB
OB -> 'salami'|'schinken'|'ananas'|'tomate'|'peperoni'|'käse'|'spinat'|'oliven'|'peperonis'|'pepperoni'
""")
ALLESPARSER = nltk.ChartParser(ALLESGRAMMAR)
SORTEN = [
# vegetarisch, Sorte, Zutaten
[1, 'Salami', 'tomatensauce', 'salami', 'käse'],
[0, 'Margherita', 'tomatensauce', 'käse'],
[0, 'Spinat', 'tomatensauce', 'spinat', 'käse'],
[1, 'Hawaii', 'tomatensauce', 'schinken', 'ananas', 'käse'],
[0, 'Funghi', 'tomatensauce, pilze, käse']
]