<commit_before># autolink
automatically detect the title of a link

```
$ ./autolink.py --help
usage: autolink.py [-h] [-f FORMAT] [-c] [-v] url

Get the linked title of URLs (similar to Quora and Facebook)

positional arguments:
  url                   the URL

optional arguments:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        output format; accepted values are 'html', 'markdown',
                        'latex', 'mediawiki'
  -c, --clean           clean the title to remove the site name if the title
                        was obtained from an HTML title tag
  -v, --verbose         enable debug messages
```

## Examples

Note that there is actually no new line at the end of outputs even though these
are inserted here to make the output nicer.
Below `$` indicates the shell prompt.

```
$ ./autolink.py -f markdown "http://causeprioritization.org/Digital%20preservation"
[Digital preservation \- Cause Prioritization Wiki](http://causeprioritization.org/Digital%20preservation)
$ ./autolink.py -f markdown "http://causeprioritization.org/Digital%20preservation" --clean
[Digital preservation](http://causeprioritization.org/Digital%20preservation)
$ ./autolink.py -f markdown "http://lesswrong.com/lw/2as/diseased_thinking_dissolving_questions_about/" --clean
[Diseased thinking: dissolving questions about disease](http://lesswrong.com/lw/2as/diseased_thinking_dissolving_questions_about/)<commit_msg>add line breaks using sed<commit_after># autolink
automatically detect the title of a link

```
$ ./autolink.py --help
usage: autolink.py [-h] [-f FORMAT] [-c] [-v] url

Get the linked title of URLs (similar to Quora and Facebook)

positional arguments:
  url                   the URL

optional arguments:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        output format; accepted values are 'html', 'markdown',
                        'latex', 'mediawiki'
  -c, --clean           clean the title to remove the site name if the title
                        was obtained from an HTML title tag
  -v, --verbose         enable debug messages
```

## Examples

Below `$` indicates the shell prompt.

```
$ ./autolink.py -f markdown "http://causeprioritization.org/Digital%20preservation" | sed 's/.*/&\n/'
[Digital preservation - Cause Prioritization Wiki](http://causeprioritization.org/Digital%20preservation)
$ ./autolink.py -f markdown "http://causeprioritization.org/Digital%20preservation" --clean | sed 's/.*/&\n/'
[Digital preservation](http://causeprioritization.org/Digital%20preservation)
$ ./autolink.py -f markdown "http://lesswrong.com/lw/2as/diseased_thinking_dissolving_questions_about/" --clean | sed 's/.*/&\n/'
[Diseased thinking: dissolving questions about disease](http://lesswrong.com/lw/2as/diseased_thinking_dissolving_questions_about/)
{'fraction_non_alphanumeric': 0.1148391560013836, 'fraction_numerical': 0.0069180214458664825, 'mean_word_length': 3.0334728033472804, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2692777', 'n_tokens_mistral': 907, 'n_tokens_neox': 841, 'n_words': 265}