问题
I want to create a data structure that is able to map a cluster or group of words to a single word or string , it can be thought as of a reverse of what a dictionary does in python .
回答1:
You can use a regular dict:
targetword = "good"
wordmap = {
"best": targetword,
"positive": targetword,
"awesome": targetword,
"fantastic": targetword
}
来源:https://stackoverflow.com/questions/37158160/a-data-structure-with-key-as-a-cluster-of-words-and-value-as-a-single-word-or-st