<commit_before># php-original-post-discovery

A set of PHP functions for determining the canonical URL for a post, given a POSSEd copy.

## Usage

Install using [Composer](https://getcomposer.org) `./composer.phar require indieweb/original-post-discovery:dev-master`.

```php
<?php

require __DIR__ . '/vendor/autoload.php';

list($url, $err) = IndieWeb\discoverOriginalPost('https://twitter.com/BarnabyWalters/status/423465842148671488');
if ($err !== null) {
	// handle HTTP errors here
}

// do stuff (e.g. auto-fill in-reply-to form controls) with $url

```

### Other functions
<commit_msg>Added link to algorithm, live demo<commit_after># php-original-post-discovery

A set of PHP functions for determining the canonical URL for a post, given a POSSEd copy. A partial implementation of the algorithm outlined at [original-post-discovery](http://indiewebcamp.com/original-post-discovery).

A demo can be found [on waterpigs.co.uk/services/original-post](http://waterpigs.co.uk/services/original-post/).

## Usage

Install using [Composer](https://getcomposer.org) `./composer.phar require indieweb/original-post-discovery:dev-master`.

```php
<?php

require __DIR__ . '/vendor/autoload.php';

list($url, $err) = IndieWeb\discoverOriginalPost('https://twitter.com/BarnabyWalters/status/423465842148671488');
if ($err !== null) {
	// handle HTTP errors here
}

// do stuff (e.g. auto-fill in-reply-to form controls) with $url

```

### Other functions

{'fraction_non_alphanumeric': 0.1429553264604811, 'fraction_numerical': 0.024742268041237112, 'mean_word_length': 4.6, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, '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': '1282233', 'n_tokens_mistral': 507, 'n_tokens_neox': 464, 'n_words': 125}