X-Git-Url: http://unremediatedgender.space/source?a=blobdiff_plain;f=notes%2Fmemoir_wordcounts.py;h=a25967c97906274154d1a6974303c25de239d09d;hb=6ea452b73027816924c45f18c4ba11b0513f277b;hp=14aebc4cf2b5330c83a9e2e8a19a34fe64fb349d;hpb=b3da6acf54f739933c373aa9c9058e84443cfdc3;p=Ultimately_Untrue_Thought.git diff --git a/notes/memoir_wordcounts.py b/notes/memoir_wordcounts.py index 14aebc4..a25967c 100755 --- a/notes/memoir_wordcounts.py +++ b/notes/memoir_wordcounts.py @@ -21,7 +21,7 @@ MONTHS = { } def wordcount_at_this_sha(): - result = subprocess.run("wc -w content/drafts/blanchards-dangerous-idea-and-the-plight-of-the-lucid-crossdreamer.md content/drafts/a-hill-of-validity-in-defense-of-meaning.md content/drafts/if-clarity-seems-like-death-to-them.md content/drafts/agreeing-with-stalin-in-ways-that-exhibit-generally-rationalist-principles.md content/drafts/standing-under-the-same-sky.md".split(), stdout=subprocess.PIPE) + result = subprocess.run("wc -w content/2023/blanchards-dangerous-idea-and-the-plight-of-the-lucid-crossdreamer.md content/drafts/a-hill-of-validity-in-defense-of-meaning.md content/drafts/if-clarity-seems-like-death-to-them.md content/drafts/agreeing-with-stalin-in-ways-that-exhibit-generally-rationalist-principles.md content/drafts/zevis-choice.md content/drafts/standing-under-the-same-sky.md content/drafts/the-last-indictment.md".split(), stdout=subprocess.PIPE) wc_lines = result.stdout.decode('utf8').split('\n') total_line = wc_lines[-2] # last line is empty return int(total_line.split()[0]) @@ -63,8 +63,11 @@ def normalize_dates(wordcounts): def write_csv(wordcounts): with open("memoir_wordcounts.csv", 'w') as f: writer = csv.writer(f) + previous = None for date, wordcount in wordcounts: - writer.writerow([date.strftime("%m/%d/%Y"), wordcount]) + diff = wordcount - previous if previous is not None else '' + writer.writerow([date.strftime("%m/%d/%Y"), wordcount, diff]) + previous = wordcount if __name__ in "__main__":