diff options
author | Anthony Wang | 2024-03-06 12:26:09 -0500 |
---|---|---|
committer | Anthony Wang | 2024-03-06 12:26:09 -0500 |
commit | e399274ba7ca5373659a69001cadc1ea6070ff5a (patch) | |
tree | 5995b292832e389f83c911906148e4b06b3e4c0b /static | |
parent | 967dae2561f62d229b64a05dac84a48703ad4e18 (diff) |
Improve short-story.py script
Diffstat (limited to 'static')
-rw-r--r-- | static/src/short-story.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/static/src/short-story.py b/static/src/short-story.py index 2748544..24a727f 100644 --- a/static/src/short-story.py +++ b/static/src/short-story.py @@ -1,15 +1,20 @@ from collections import Counter from re import sub +from os import system +from os.path import isfile def cnt(filename): c = Counter() with open(filename) as f: - for w in f.read().split(): + for w in f.read().split('.*')[1].split(): c[sub(r'[^a-zA-Z]', '', w).lower()] += 1 return c +if not isfile('/tmp/orig'): + system('echo ".*" > /tmp/orig && curl https://raw.githubusercontent.com/awestover/skyspace/master/posts/misc/src/02-25-24.md | tail -n +10 >> /tmp/orig') + A = cnt('/tmp/orig') -B = cnt('/tmp/mine') +B = cnt('content/posts/short-story-2.md') print(A.keys(), B.keys()) print('-------------- OVERUSED') for b in B.keys(): |