<commit_before># NWS CAP Parser

A lightweight Python module to make parsing National Weather Service (NWS) alerts easy.

##  Common Alerting Protocol (CAP)

The NWS publishes weather alerts and advisories in the CAP format via Atom feeds. More information - and a 
full list of US feeds - can be found on the NWS CAP [home page](http://alerts.weather.gov/).

## NWSCAPParser

The nwscapparser module exports a single class, NWSCAPParser. To use this class, pass a string containing the
XML from a CAP alert as the only param to the initialization call:
```python
fn = r'cap.IL124CA04A2F50.SevereThunderstormWarning.xml'	# included (actual) alert
src = open(fn,'r').read()
alert = NWSCAPParser(src)
```

See the demo file `demo.py` for more examples of the methods and fields available in a parsed alert instance.
<commit_msg>added note about FIPS6 codes<commit_after># NWS CAP Parser

A lightweight Python module to make parsing National Weather Service (NWS) alerts easy.

##  Common Alerting Protocol (CAP)

The NWS publishes weather alerts and advisories in the CAP format via Atom feeds. More information - and a 
full list of US feeds - can be found on the NWS CAP [home page](http://alerts.weather.gov/).

## NWSCAPParser

The nwscapparser module exports a single class, NWSCAPParser. To use this class, pass a string containing the
XML from a CAP alert as the only param to the initialization call:
```python
fn = r'cap.IL124CA04A2F50.SevereThunderstormWarning.xml'	# included (actual) alert
src = open(fn,'r').read()
alert = NWSCAPParser(src)
```

Of note, the instance easily exposes the FIPS6 county codes (also known as SAME codes) that the alert references.

See the demo file `demo.py` for more examples of the methods and fields available in a parsed alert instance.

{'fraction_non_alphanumeric': 0.0718294051627385, 'fraction_numerical': 0.010101010101010102, 'mean_word_length': 4.571875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1001133', 'n_tokens_mistral': 558, 'n_tokens_neox': 505, 'n_words': 249}