擅长:python、mysql、java
<p>你不需要一个完整的多目录;你只需要一个<code>Counter</code></p>
<pre><code>from collections import Counter
def get_frequency_dict_for_text(sentence):
skip_words = {"a", "the", "an", ...}
words = (x.lower() for x in sentence.split(" ") if x not in skip_words)
return Counter(words)
</code></pre>