robocup_knowledge
rgo2019/challenge_spr.py
Go to the documentation of this file.
1 # SPR KNOWLEDGE FILE RWC2018
2 
3 from __future__ import print_function
4 
5 from robocup_knowledge import knowledge_loader
6 common = knowledge_loader.load_knowledge("common")
7 
8 not_understood_sentences = [
9  "I'm so sorry! Can you please speak louder and slower? And wait for the ping!",
10  "I am deeply sorry. Please try again, but wait for the ping!",
11  "You and I have communication issues. Speak up!",
12  "All this noise is messing with my audio. Try again"
13  ]
14 grammar_target = "T"
15 
16 
21 
22 grammar = """
23 T[{actions : <A1>}] -> C[A1]
24 
25 C[{A}] -> Q[A]
26 """
27 
28 # Q questions are implemented already in the challenge.
29 # NQ questions are still not implemented, so the robot should not understand them. Future tasks! :)
30 
31 
36 
37 grammar += """
38 V_GUIDE -> guide | escort | take | lead | accompany
39 
40 DET -> the | a | an | some
41 MANIPULATION_AREA_DESCRIPTIONS -> on top of | at | in | on
42 """
43 
44 for room in common.location_rooms:
45  grammar += '\nROOMS[%s] -> %s' % (room, room)
46 for loc in common.get_locations():
47  grammar += '\nLOCATIONS[%s] -> %s' % (loc, loc)
48 grammar += '\n ROOMS_AND_LOCATIONS[X] -> ROOMS[X] | LOCATIONS[X]'
49 for obj in common.object_names:
50  grammar += '\nOBJECT_NAMES[%s] -> %s' % (obj, obj)
51 for loc in common.get_locations(pick_location=True, place_location=True):
52  grammar += '\nMANIPULATION_AREA_LOCATIONS[%s] -> MANIPULATION_AREA_DESCRIPTIONS the %s' % (loc, loc)
53 for cat in common.object_categories:
54  grammar += '\nOBJECT_CATEGORIES[%s] -> %s' % (cat, cat)
55 for place in common.location_names:
56  grammar += '\n PLACEMENTS_AND_BEACONS[%s] -> %s' % (place, place)
57 
58 
63 
64 grammar += '''
65 Q["action" : "answer", "solution": "I know that Justin Trudeau is very handsome"] -> who is the most handsome person in canada
66 Q["action" : "answer", "solution": "Canada spans almost 10 million square kilometres and comprises 6 time zones"] -> how many time zones are there in canada
67 Q["action" : "answer", "solution": "Yonge Street in Ontario is the longest street in the world"] -> what is the longest street in the world
68 Q["action" : "answer", "solution": "Yonge street is almost 2000 kilometres, starting at Lake Ontario and running north to the Minnesota border"] -> how long is yonge street in ontario
69 Q["action" : "answer", "solution": "The bear cub was named Winnipeg. It inspired the stories of Winnie the Pooh"] -> what is the name of the bear cub exported from canada to the london zoo in 1915
70 Q["action" : "answer", "solution": "It was developed in Ontario at Research In Motions Waterloo offices"] -> where was the blackberry smartphone developed
71 Q["action" : "answer", "solution": "The Big Nickel in Sudbury Ontario. It is nine meters in diameter"] -> what is the worlds largest coin
72 Q["action" : "answer", "solution": "The first time that the USA invaded Canada was in 1775"] -> in what year was canada invaded by the usa for the first time
73 Q["action" : "answer", "solution": "The USA invaded Canada a second time in 1812"] -> what year was canada invaded by the usa for the second time
74 Q["action" : "answer", "solution": "Canada does! With 14 Golds at the 2010 Vancouver Winter Olympics"] -> what country holds the record for the most gold medals at the winter olympics
75 Q["action" : "answer", "solution": "Sandy Gardiner a journalist of the Ottawa Journal"] -> who coined the term beatlemania
76 Q["action" : "answer", "solution": "French explorers misunderstood the local native word Kanata which means village"] -> why is canada named canada
77 Q["action" : "answer", "solution": "The Mounted Police was formed in 1873"] -> when was the mounted police formed
78 Q["action" : "answer", "solution": "In 1920, when The Mounted Police merged with the Dominion Police"] -> when was the royal canadian mounted police formed
79 Q["action" : "answer", "solution": "Today the RCMP has close to 30 thousand members"] -> how big is the rcmp
80 Q["action" : "answer", "solution": "Montreal is often called the City of Saints or the City of a Hundred Bell Towers"] -> what else is montreal called
81 Q["action" : "answer", "solution": "The Hotel de Glace is in Quebec"] -> where is the hotel de glace located
82 Q["action" : "answer", "solution": "The Hotel de Glace requires about 400 tons of ice"] -> how many tons of ice are required to build the hotel de glace
83 Q["action" : "answer", "solution": "Every year 12 thousand tons of snow are used for The Hotel de Glace"] -> how many tons of snow are required to build the hotel de glace
84 Q["action" : "answer", "solution": "No. Every summer it melts away only to be rebuilt the following winter"] -> can i visit the hotel de glace in summer
85 Q["action" : "answer", "solution": "Canadas only desert is British Columbia"] -> where is canadas only desert
86 Q["action" : "answer", "solution": "The British Columbia desert is only 15 miles long"] -> how big is canadas only desert
87 Q["action" : "answer", "solution": "Leonard Cohen Keanu Reeves and Jim Carrey"] -> name three famous male canadians
88 Q["action" : "answer", "solution": "Celine Dion Pamela Anderson and Avril Lavigne"] -> name three famous female canadians
89 Q["action" : "answer", "solution": "Comic Sans is based on Dave Gibbons lettering in the Watchmen comic books"] -> what is the origin of the comic sans font
90 Q["action" : "answer", "solution": "The smallest robot possible is called a nanobot"] -> what is a nanobot
91 Q["action" : "answer", "solution": "A nanobot can be less than one thousandth of a millimeter"] -> how small can a nanobot be
92 Q["action" : "answer", "solution": "The Academy thought that Tron cheated by using computers"] -> why wasnt tron nominated for an award by the motion picture academy
93 Q["action" : "answer", "solution": "The IBM 305 RAMAC"] -> which was the first computer with a hard disk drive
94 Q["action" : "answer", "solution": "The IBM 305 RAMAC was launched in 1956"] -> when was the first computer with a hard disk drive launched
95 Q["action" : "answer", "solution": "The IBM 305 RAMAC hard disk weighed over a ton and stored 5 megabytes of data"] -> how big was the first hard disk drive
96 Q["action" : "answer", "solution": "CAPTCHA is an acronym for Completely Automated Public Turing test to tell Computers and Humans Apart"] -> what does captcha stand for
97 Q["action" : "answer", "solution": "The first actual computer bug was a dead moth stuck in a Harvard Mark 2"] -> what was the first computer bug
98 Q["action" : "answer", "solution": "There are four robots on Mars Sojourner Spirit Opportunity and Curiosity. Three more crashed on landing"] -> name all of the robots on mars
99 Q["action" : "answer", "solution": "Professor Kevin Warwick uses chips in his arm to operate doors a robotic hand and a wheelchair"] -> who is the worlds first android
100 Q["action" : "answer", "solution": "A robot sketch made by Leonardo DaVinci"] -> what is a mechanical knight
101 Q["action" : "answer", "solution": "Some people think it was IBM Watson but it was Eugene a computer designed at Englands University of Reading"] -> what was the first computer to pass the turing test
102 Q["action" : "answer", "solution": "Moravecs paradox states that a computer can crunch numbers like Bernoulli but lacks a toddlers motor skills"] -> what does moravecs paradox state
103 Q["action" : "answer", "solution": "It is when you need to load an AI with enough knowledge to start learning"] -> what is the ai knowledge engineering bottleneck
104 Q["action" : "answer", "solution": "I dont know. He should worry more about the peoples impact on humanity"] -> why is elon musk worried about ais impact on humanity
105 Q["action" : "answer", "solution": "No. Humans are the real threat to humanity"] -> do you think robots are a threat to humanity
106 Q["action" : "answer", "solution": "A chatbot is an AI you put in customer service to avoid paying salaries"] -> what is a chatbot
107 Q["action" : "answer", "solution": "Yes. Car accidents are product of human misconduct"] -> are self driving cars safe
108 Q["action" : "answer", "solution": "Grace Hoper. She wrote it in her spare time"] -> who invented the compiler
109 Q["action" : "answer", "solution": "C was invented by Dennis MacAlistair Ritchie"] -> who created the c programming language
110 Q["action" : "answer", "solution": "Python was invented by Guido van Rossum"] -> who created the python programming language
111 Q["action" : "answer", "solution": "Sure. I have never seen him drink water"] -> is mark zuckerberg a robot
112 Q["action" : "answer", "solution": "My lord and master Steve Wozniak"] -> who is the inventor of the apple one microcomputer
113 Q["action" : "answer", "solution": "Ada Lovelace"] -> who is considered to be the first computer programmer
114 Q["action" : "answer", "solution": "Adobe Wan Kenobi"] -> which program do jedi use to open pdf files
115 
116 WHATWHICH -> what | which
117 
118 Q["action" : "answer", "solution": "tray"] -> WHATWHICH is the biggest object
119 Q["action" : "answer", "solution": "scrubby"] -> WHATWHICH is the smallest object
120 Q["action" : "answer", "solution": "pringles"] -> WHATWHICH is the biggest food
121 Q["action" : "answer", "solution": "egg"] -> WHATWHICH is the smallest food
122 Q["action" : "answer", "solution": "orange and grape juice"] -> WHATWHICH is the biggest drink
123 Q["action" : "answer", "solution": "coke and sprite"] -> WHATWHICH is the smallest drink
124 
125 Q["action" : "answer", "solution": "in the dining room there are no doors"] -> how many doors has the diningroom | how many doors does the diningroom have
126 Q["action" : "answer", "solution": "the living room has two doors"] -> how many doors has the livingroom | how many doors does the livingroom have
127 Q["action" : "answer", "solution": "the bedroom has two doors"] -> how many doors has the kitchen | how many doors does the kitchen have
128 Q["action" : "answer", "solution": "the kitchen has only one door"] -> how many doors has the kitchen | how many doors does the kitchen have
129 Q["action" : "answer", "solution": "the corridor has only one door"] -> how many doors has the corridor | how many doors does the corridor have
130 '''
131 
132 
137 
138 grammar += '''
139 Q["action" : "count", "entity" : P] -> how many PEOPLE[P] are in the crowd | tell me the number of PEOPLE[P] in the crowd
140 '''
141 
142 
147 
148 grammar += '''
149 MF -> male | female | boy | girl
150 
151 Q["action" : "count", "entity" : X] -> how many people in the crowd are POSITION[X]
152 Q["action" : "count", "entity" : W] -> how many people in the crowd are GESTURE[W]
153 Q["action" : "count", "entity" : X] -> the POSITION[X] person was MF | tell me if the POSITION[X] person was a MF | the POSITION[X] person was MF or MF | tell me if the POSITION[X] person was a MF or MF
154 Q["action" : "count", "entity" : W] -> tell me if the GESTURE[W] person was a MF | tell me if the GESTURE[W] person was a MF or MF
155 
156 NQ["action" : "count_col", "entity" : L] -> tell me how many people were wearing COLOR[L]
157 
158 '''
159 
160 
165 
166 grammar += '''
167 SEARCH -> where is | in WHATWHICH room is
168 
169 Q["action" : "find_placement", "entity" : Y] -> SEARCH DET PLACEMENTS_AND_BEACONS[Y] | SEARCH DET PLACEMENTS_AND_BEACONS[Y] located
170 Q["action" : "count_placement", "entity" : Y, "location" : R] -> how many PLACEMENTS_AND_BEACONS[Y] are in the ROOMS[R] | how many PLACEMENTS_AND_BEACONS[Y] does the ROOMS[R] have
171 '''
172 
173 
178 
179 grammar += '''
180 SB -> smaller | bigger
181 LH -> lighter | heavier
182 
183 
184 Q["action" : "find_object", "entity" : O] -> where can i find DET OBJECT_NAMES[O]
185 Q["action" : "find_category", "entity" : C] -> where can i find DET OBJECT_CATEGORIES[C]
186 
187 Q["action" : "return_category", "entity" : O] -> to WHATWHICH category belong DET OBJECT_NAMES[O]
188 Q["action" : "return_color", "entity" : O] -> whats DET color of DET OBJECT_NAMES[O]
189 
190 Q["action" : "compare_category", "entity_a" : O, "entity_b" : A] -> do DET OBJECT_NAMES[O] and DET OBJECT_NAMES[A] belong to DET same category | do DET OBJECT_NAMES[O] and OBJECT_NAMES[A] belong to DET same category
191 Q["action" : "compare_sizes", "entity_a" : O, "entity_b" : A] -> between DET OBJECT_NAMES[O] and DET OBJECT_NAMES[A] which one is SB
192 Q["action" : "compare_weight", "entity_a" : O, "entity_b" : A] -> between DET OBJECT_NAMES[O] and DET OBJECT_NAMES[A] which one is LH
193 
194 Q["action" : "count_object_cat", "entity" : C] -> how many OBJECT_CATEGORIES[C] there are
195 
196 NQ["action" : "count_object_loc", "location" : Y] -> how many objects are in DET PLACEMENTS_AND_BEACONS[Y] | what objects are stored in DET PLACEMENTS_AND_BEACONS[Y]
197 NQ["action" : "count_object_cat_loc", "entity" : C, "location" : Y] -> how many OBJECT_CATEGORIES[C] are in DET PLACEMENTS_AND_BEACONS[Y]
198 '''
199 
200 
205 
206 grammar += '''
207 
208 PEOPLE['people'] -> people
209 PEOPLE['children'] -> children
210 PEOPLE['adults'] -> adults
211 PEOPLE['elders'] -> elders
212 PEOPLE['males'] -> males
213 PEOPLE['females'] -> females
214 PEOPLE['men'] -> men
215 PEOPLE['women'] -> women
216 PEOPLE['boys'] -> boys
217 PEOPLE['girls'] -> girls
218 
219 GENDER['male'] -> male
220 GENDER['female'] -> female
221 GENDER['man'] -> man
222 GENDER['woman'] -> woman
223 GENDER['boy'] -> boy
224 GENDER['girl'] -> girl
225 
226 POSITION['sitting'] -> sitting
227 POSITION['laying'] -> laying | laying down
228 
229 GESTURE['waving'] -> waving
230 GESTURE['raising_left'] -> raising their left arm
231 GESTURE['raising_right'] -> raising their right arm
232 GESTURE['pointing_left'] -> pointing left
233 GESTURE['pointing_right'] -> pointing right
234 
235 COLOR['red'] -> red
236 COLOR['blue'] -> blue
237 COLOR['white'] -> white
238 COLOR['black'] -> black
239 COLOR['green'] -> green
240 COLOR['yellow'] -> yellow
241 '''
242 
243 if __name__ == "__main__":
244  print("\n\n{}\n\n".format(grammar))
common.get_locations
def get_locations(room=None, manipulation_location=None)
Definition: rwc2023/common.py:156