Created
December 9, 2015 18:24
-
-
Save jdherman/c693375c80217e8321d8 to your computer and use it in GitHub Desktop.
exstatic syllabi keyword analysis
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
import glob | |
kw = ['climate', 'decision theory', 'dynamic', 'economics', 'game theory', 'heuristic', 'hydrology', | |
'integer', 'linear', 'model', 'nonlinear', 'policy', 'probability', 'statistics', | |
'stochastic','quality', 'simulation', 'optimization'] | |
files = glob.glob('*.txt') | |
courses_including = {} | |
avg_count = {} | |
for k in kw: | |
courses_including[k] = 0 | |
avg_count[k] = 0 | |
for f in files: | |
total = 0 | |
for line in open(f): | |
if k in line.lower(): | |
if total == 0: | |
courses_including[k] += 1 | |
total += 1 | |
avg_count[k] += total | |
avg_count[k] /= courses_including[k] | |
for k,v in courses_including.iteritems(): | |
print '%s,%d,%d' % (k,v,avg_count[k]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment