The symbol grounding problem is about connecting sensory data with natural language. An example is a pattern matching software for detecting roads in the context of autonomous driving. To prototype has only text based unicode output and the amount of possible shapes is small. But it can annotate these shapes with textual tags.
An example tagging output is: ['one', 'tjunction_left'] which can be translated into “the road has one lane, and a T-junction is ahead which allows to drive left or ahead”. From a programming perspective, the algorithm was realized with a dictionary. The possible shapes including the tags are hard coded in the Python sourcecode, which allows to assign a certain road to the tags. The idea is to partitioning the scene space with natural language tags which reduces the complexity.
"""
unicode road generator, example output:
0 ┃ annotation: ['one', 'straight']
1 ═╦═ annotation: ['two', 'tjunction_ahead']
2 ╠═ annotation: ['two', 'tjunction_right']
3 ━┫ annotation: ['one', 'tjunction_left']
"""
import random
class Game:
def __init__(self):
for trial in range(4):
# new random number
self.lanes=random.randint(0,1)
self.shape=random.randint(0,6)
print(trial,self.getscreen()," annotation:",self.gettag())
def getcat(self,catdict,value): # return: category in dict
for i in catdict:
if value<=i: return catdict[i]
def getscreen(self): # return: text with unicode road
drawing=[["┃","━┓","┏━","━┳━","━┫","┣━","━╋━"], ["║","═╗","╔═","═╦═","═╣","╠═","═╬═"]]
return drawing[self.lanes][self.shape]
def gettag(self): # tagging
return [
self.getcat({0:"one", 1:"two"},self.lanes), # lanes
self.getcat({0:"straight", 1:"leftturn", 2:"rightturn", 3:"tjunction_ahead",4:"tjunction_left",5:"tjunction_right",6:"crossing"},self.shape), # shape
]
if __name__ == '__main__':
g=Game()
May 16, 2025
Symbol grounding in 30 lines of code
Labels:
Grounding problem
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment