Script to count words over time in Tex files hosted on Git. Originally inspired by http://phdcomics.com/comics/archive_print.php?comicid=1915 and from Git Count Words LateX script by Bastian Rieck, originally available at https://gist.github.com/Submanifold/d7b996492dc3020f2acea87b49cc54c3.
NOTE! This solution uses Git's
--word-diff
to get the word count, which over estimates. Meaning that comments, tables etc. are all included in the word count!
$ pip install -r requirements.txt
$ ./word_count.sh
If you only want to incude certain files (e.g., chapter.tex files), replace *.tex
in git command:
...
added=$(git show -p --word-diff=porcelain $commit -- "*abstract.tex" "*chap*.tex" "*introduction.tex" | grep -e '^+[^+]' | wc -w)
deleted=$(git show -p --word-diff=porcelain $commit -- "*abstract.tex" "*chap*.tex" "*introduction.tex" | grep -e '^-[^-]' | wc -w)
...
To set daily writing goals modify $daily_goal
parameter in word_count.sh
script and use today to run the script.
./word_count.sh today
./word_count.sh | ./makegraph.py
- annotations
- add ignore meta files
- automatic GIT hooks for making graph