<commit_before>php-language-processing
=======================

A PHP library for language processing. Includes string distance function (Levenshtein, Jaro-Winkler,...), stemming, etc.<commit_msg>Readme : usage<commit_after>php-language-processing
=======================

A PHP library for language processing. Includes string distance function (Levenshtein, Jaro-Winkler,...), stemming, etc.

Usage
-----

```php
use webd\language\StringDistance;

$string1 = "You won 10000$";
$string2 = "You won 15500$";

echo "Edit distance : " . StringDistance::EditDistance($string1, $string2);
echo "Levenshtein : " . StringDistance::Levenshtein($string1, $string2);
echo "Jaro-Winkler : " . StringDistance::JaroWinkler($string1, $string2);
echo "Jaro-Winkler (prefix scale = 0.2) : " . StringDistance::JaroWinkler($string1, $string2, 0.2);

use webd\language\PorterStemmer;
echo "analyzing => " . PorterStemmer::Stem("analyzing");
echo "abandoned => " . PorterStemmer::Stem("abandoned");
echo "inclination => " . PorterStemmer::Stem("inclination");
```
{'fraction_non_alphanumeric': 0.19348659003831417, 'fraction_numerical': 0.022988505747126436, 'mean_word_length': 6.157534246575342, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '3449760', 'n_tokens_mistral': 362, 'n_tokens_neox': 331, 'n_words': 74}