如果我有两个这样的字符串
s1 = "This is a foo bar sentence ."
s2 = "This sentence is similar to a foo bar sentence ."
我想将字符串拆分为这种格式
x1 = ["This":1,"is":1,"a":1,"bar":1,"sentence":1,"foo":1]
x2 = ["This":1,"is":1,"a":1,"bar":1,"sentence":2,"similar":1,"to":1,"foo":1]
它将字符串单词拆分并计数,成对,其中每个字符串代表一个单词,数字表示该单词在字符串中的计数。