<commit_before>html-table-parser-python3
=========================

This module consists of just one small class. Its purpose is to parse HTML tables without help of external modules. Everything I use is part of python 3. Instead of installing this module, you can just copy the class located in *parse.py* into your own code.

```python
import urllib.request
from pprint import pprint
from html_table_parser import HTMLTableParser # import the parser class somehow

target = 'http://www.twitter.com'

# get website content
req = urllib.request.Request(url=target)
f = urllib.request.urlopen(req)
xhtml = f.read().decode('utf-8')

# instantiate the parser and feed it
p = HTMLTableParser()
p.feed(xhtml)
pprint(p.tables)
```

`p.tables` returns nested lists of tables containing rows containig cells as string. Tags in cells are stripped and the tags text content is joined. The console output for parsing all tables on the twitter home page looks like this:

```
>>> 
[[['   ', ' Anmelden ']],
 [['Land', 'Code', 'Für Kunden von'],
  ['Vereinigte Staaten', '40404', '(beliebig)'],
  ['Kanada', '21212', '(beliebig)'],
  ...
  ['3424486444', 'Vodafone'],
  ['  Zeige SMS-Kurzwahlen für andere Länder ']]]
```
<commit_msg>Strings are trimmed by the parser<commit_after>html-table-parser-python3
=========================

This module consists of just one small class. Its purpose is to parse HTML tables without help of external modules. Everything I use is part of python 3. Instead of installing this module, you can just copy the class located in *parse.py* into your own code.

```python
import urllib.request
from pprint import pprint
from html_table_parser import HTMLTableParser # import the parser class somehow

target = 'http://www.twitter.com'

# get website content
req = urllib.request.Request(url=target)
f = urllib.request.urlopen(req)
xhtml = f.read().decode('utf-8')

# instantiate the parser and feed it
p = HTMLTableParser()
p.feed(xhtml)
pprint(p.tables)
```

`p.tables` returns nested lists of tables containing rows containig cells as string. Tags in cells are stripped and the tags text content is joined. The console output for parsing all tables on the twitter home page looks like this:

```
>>> 
[[['', 'Anmelden']],
 [['Land', 'Code', 'Für Kunden von'],
  ['Vereinigte Staaten', '40404', '(beliebig)'],
  ['Kanada', '21212', '(beliebig)'],
  ...
  ['3424486444', 'Vodafone'],
  ['Zeige SMS-Kurzwahlen für andere Länder']]]
```

{'fraction_non_alphanumeric': 0.13773431132844335, 'fraction_numerical': 0.018744906275468622, 'mean_word_length': 4.762910798122066, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '2665023', 'n_tokens_mistral': 793, 'n_tokens_neox': 734, 'n_words': 291}