def prefix_match(s, taglist):
    words = s.split()
return [w for t in taglist for w in words if w.startswith(t)]
s = 'This is such an nice artwork'
taglist = ['art', 'paint']
prefix_match(s, taglist)
сопоставление префиксов в python