<commit_before># usda-costoffood

usda-costoffood is a collection of scripts to retrieve and analyze monthly [USDA Cost of Food Reports](http://www.cnpp.usda.gov/USDAFoodPlansCostofFood/reports) which are distributed as `.pdf` files.

Setup Requirements
------------------
All scripts run in Python 2.7 and Python 3. 
The required python packages specified in the requirements.txt file should be downloaded into system packages or a virtualenv.

This project relies on the `pdftotext` executable from [xpdf](http://www.foolabs.com/xpdf/download.html).

Downloading USDA Cost of Food Reports
-------------------------------------
USDA Cost of Food Reports are published monthly in `.pdf` format. To download all available reports run:

```bash
$ python downloadcofpdfs.py
```

Although `downloadcofpdfs.py` runs with multi-processing there are more than 240 published reports and the script will take several minutes.

Creating `.txt` Files from `.pdf`
---------------------------------
Generating `.txt` files relies on `pdftotext`. To generate all `.txt` files from the downloaded reports run:

```bash
$ ./generate_txts.sh
```
Currently `pdftotext` generates empty files for report earlier than May 1997 making this data inaccessible.<commit_msg>Update pdftotext version number<commit_after># usda-costoffood

usda-costoffood is a collection of scripts to retrieve and analyze monthly [USDA Cost of Food Reports](http://www.cnpp.usda.gov/USDAFoodPlansCostofFood/reports) which are distributed as `.pdf` files.

Setup Requirements
------------------
All scripts run in Python 2.7 and Python 3. 
The required python packages specified in the requirements.txt file should be downloaded into system packages or a virtualenv.

This project relies on the `pdftotext`version 0.26.5  executable from [xpdf](http://www.foolabs.com/xpdf/download.html).

Downloading USDA Cost of Food Reports
-------------------------------------
USDA Cost of Food Reports are published monthly in `.pdf` format. To download all available reports run:

```bash
$ python downloadcofpdfs.py
```

Although `downloadcofpdfs.py` runs with multi-processing there are more than 240 published reports and the script will take several minutes.

Creating `.txt` Files from `.pdf`
---------------------------------
Generating `.txt` files relies on `pdftotext`. To generate all `.txt` files from the downloaded reports run:

```bash
$ ./generate_txts.sh
```
Currently `pdftotext` generates empty files for report earlier than May 1997 making this data inaccessible.
{'fraction_non_alphanumeric': 0.13997627520759193, 'fraction_numerical': 0.009489916963226572, 'mean_word_length': 3.3620689655172415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7498751', 'n_tokens_mistral': 719, 'n_tokens_neox': 651, 'n_words': 293}