Created
July 23, 2013 14:58
-
-
Save randyzwitch/6062999 to your computer and use it in GitHub Desktop.
Julia, Python, looping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Python looping to create a term-frequency dictionary | |
from collections import Counter | |
term_freq = Counter() | |
for word in english_dictionary: | |
for url in url_list: | |
if word in url_list: | |
term_freq[word] += 1 | |
#Julia looping to create a term-frequency dictionary | |
term_freq=Dict{String, Int64}() | |
for word in english_dictionary | |
for url in url_list | |
if search(line, word) != (0:-1) | |
term_freq[word]=get(term_freq,word,0)+1 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment