質問

Is there any way to clean a text from whitespaces and dots, commas without NLTK, but especially by regular expressions?

役に立ちましたか?

解決

If I have understood your question you can try this code

import re

text = "Split.this,text in seven.separate,words"

myexp=re.compile(r'[\s.,]')

print myexp.split(text)

that gives you this output

['Split', 'this', 'text', 'in', 'seven', 'separate', 'words']
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top