Use list comprehession and regular expression to implement getNameScore function