import re
p = re.compile(r'[^\W_]+')
test_str = "feature.append(freq_and_feature(text, freq))"
 
print(re.findall(p, test_str))