PHPackages                             webd/language - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. webd/language

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

webd/language
=============

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

0.4(1mo ago)28175.9k↓12.5%51MITPHPCI passing

Since Dec 16Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/tdebatty/php-language-processing)[ Packagist](https://packagist.org/packages/webd/language)[ RSS](/packages/webd-language/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (1)

php-language-processing
=======================

[](#php-language-processing)

[![GitHub Workflows](https://github.com/tdebatty/php-language-processing/workflows/tests/badge.svg)](https://github.com/tdebatty/php-language-processing/workflows/tests/badge.svg)[![Packagist Version](https://camo.githubusercontent.com/ef53cd2bc5734337af0e38e01f940b10e53e0460fc43b40f3f39d43cff8cd606/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776562642f6c616e6775616765)](https://camo.githubusercontent.com/ef53cd2bc5734337af0e38e01f940b10e53e0460fc43b40f3f39d43cff8cd606/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776562642f6c616e6775616765)[![Packagist Downloads](https://camo.githubusercontent.com/2d748f94759f1fd74f2ce0d2f00a77a9a2e2b9506b0e6c6758ba810e6514beaf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776562642f6c616e6775616765)](https://camo.githubusercontent.com/2d748f94759f1fd74f2ce0d2f00a77a9a2e2b9506b0e6c6758ba810e6514beaf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776562642f6c616e6775616765)

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

Installation
------------

[](#installation)

```
composer require webd/language
```

Usage
-----

[](#usage)

```
// ------------ n-gram string similarity

use webd\language\StringSimilarity\DiceCoefficient;
use webd\language\StringSimilarity\JaccardSimilarity;

$dice = new DiceCoefficient(2);
$jaccard = new JaccardSimilarity(2);

$a = "context";
$b = "contact";

// 0.5
echo $dice->similarity($a, $b) . PHP_EOL;

// context : ["co", "on", "nt", "te", "ex", "xt"]
// contact : ["co", "on", "nt", "ta", "ac", "ct"]
// jacccard similarity : 3 / 9
// 0.33333
echo $jaccard->similarity($a, $b) . PHP_EOL;

// ------------ string distance

use webd\language\StringDistance;

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

// 2
echo "Edit distance : " . StringDistance::editDistance($string1, $string2) . PHP_EOL;

// 2
echo "Levenshtein : " . StringDistance::levenshtein($string1, $string2) . PHP_EOL;

$lcs = new \webd\language\LCS($string1, $string2);
// You won 100$
echo $lcs->value() . PHP_EOL;

// 12
echo $lcs->length() . PHP_EOL;

// 4
echo $lcs->distance() . PHP_EOL;

// -------------- jaro-winkler string similarity

// 0.96428571428571
echo "Jaro-Winkler : " . StringDistance::jaroWinkler($string1, $string2) . PHP_EOL;

// 0.98809523809524
echo "Jaro-Winkler (prefix scale = 0.2) : " . StringDistance::jaroWinkler($string1, $string2, 0.2) . PHP_EOL;

// -------------- stemming

use webd\language\PorterStemmer;

// analyz
echo "analyzing => " . PorterStemmer::stem("analyzing") . PHP_EOL;

// abandon
echo "abandoned => " . PorterStemmer::stem("abandoned") . PHP_EOL;

// inclin
echo "inclination => " . PorterStemmer::stem("inclination") . PHP_EOL;

// -------------  SpamSum, aka ssdeep, aka Context-Triggered Piecewize Hashing (CTPH)
$s = new \webd\language\SpamSum;
// 192:x+cMdRiWqk2YODjCoG4OU88/ffcQ+lsCYDIlp6+TF244htoJFUjw:krovCLA9byp6+52jhtnjw
echo $s->HashString(file_get_contents(__DIR__ . "/SpamSum.php")) . PHP_EOL;
```

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance89

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1372 days

Total

4

Last Release

53d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c315a5fa6bd564f98127e90046ff629dad5a22cd509cc53d07f5858c85b08fc?d=identicon)[tdebatty](/maintainers/tdebatty)

---

Top Contributors

[![tdebatty](https://avatars.githubusercontent.com/u/872972?v=4)](https://github.com/tdebatty "tdebatty (37 commits)")[![SamMousa](https://avatars.githubusercontent.com/u/547021?v=4)](https://github.com/SamMousa "SamMousa (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/webd-language/health.svg)

```
[![Health](https://phpackages.com/badges/webd-language/health.svg)](https://phpackages.com/packages/webd-language)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
