标签: python nltk
我想在标题案例中的所有单词之前加上逗号。为此,我尝试使用令牌:
text="Hey, I would like To Have a chocolate CAKE" tokens=word_tokenize(text) for word in tokens: if word.istitle(): word="," + word
但tokens没有任何变化。为什么呢?
tokens