PHPackages                             hybridlogic/classifier - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. hybridlogic/classifier

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

hybridlogic/classifier
======================

A Naive Bayesian classification library for PHP with support for different tokenizers to optimize string classification.

v1.0.2(13y ago)801.4k10MITPHPPHP &gt;=5.3.0

Since Jan 10Pushed 13y ago10 watchersCompare

[ Source](https://github.com/Dachande663/PHP-Classifier)[ Packagist](https://packagist.org/packages/hybridlogic/classifier)[ Docs](https://github.com/Dachande663/PHP-Classifier)[ RSS](/packages/hybridlogic-classifier/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Bayesian Classification Library
===============================

[](#bayesian-classification-library)

A Naive Bayesian classification library for PHP with support for different tokenizers to optimize string classification.

[![Build Status](https://camo.githubusercontent.com/1d5d680089f26f4f57b7b85f751ea17675baca4ce8d373203b58eaa60c9f8c04/68747470733a2f2f7472617669732d63692e6f72672f44616368616e64653636332f5048502d436c61737369666965722e706e67)](https://travis-ci.org/Dachande663/PHP-Classifier)

0.0 Table of Contents
---------------------

[](#00-table-of-contents)

- Introduction
- Examples
- Running Tests
- Troubleshooting
- Changelog

1.0 Introduction
----------------

[](#10-introduction)

Naive Bayesian Classification provides a computationally cheap, but reasonably accurate method of determining which "group" a provided string belongs to given a prior training set.

PHP Classifier supports any number of groups to classify strings against and uses logarithmic counting to prevent integer underflow when using larger sets.

2.0 Examples
------------

[](#20-examples)

```
$tokenizer = new HybridLogic\Classifier\Basic;
$classifier = new HybridLogic\Classifier($tokenizer);

$classifier->train('hot', 'The sun is hot');
$classifier->train('hot', 'It was a warm day in the sun');
$classifier->train('hot', 'This tea is hot!');

$classifier->train('cold', 'This ice is very cold!');
$classifier->train('cold', 'It\'s cold at night');
$classifier->train('cold', 'Ice formed on my at over night');

$groups = $classifier->classify('It was chilly last night');
```

3.0 Running Tests
-----------------

[](#30-running-tests)

phpunit tests

4.0 Troubleshooting
-------------------

[](#40-troubleshooting)

@todo

5.0 Changelog
-------------

[](#50-changelog)

- **\[2013-01-10\]** Initial port from KoBayes

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

3

Last Release

4874d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aedcc742160323259a035924ab75295484c394d67fe1ab3b855620ba790785eb?d=identicon)[Dachande663](/maintainers/Dachande663)

---

Top Contributors

[![Dachande663](https://avatars.githubusercontent.com/u/106847?v=4)](https://github.com/Dachande663 "Dachande663 (3 commits)")

---

Tags

tokenizergroupsstatisticsbayesclassifier

### Embed Badge

![Health badge](/badges/hybridlogic-classifier/health.svg)

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

###  Alternatives

[yethee/tiktoken

PHP version of tiktoken

1583.1M15](/packages/yethee-tiktoken)[gioni06/gpt3-tokenizer

PHP package for Byte Pair Encoding (BPE) used by GPT-3.

85537.5k8](/packages/gioni06-gpt3-tokenizer)[rajentrivedi/tokenizer-x

TokenizerX calculates required tokens for given prompt

91214.0k3](/packages/rajentrivedi-tokenizer-x)[nicoswd/php-rule-parser

Rule Engine - Rule Parser &amp; Evaluator

13078.6k7](/packages/nicoswd-php-rule-parser)[jeremeamia/functionparser

Function parser for PHP functions, methods, and closures

48169.7k6](/packages/jeremeamia-functionparser)[danny50610/bpe-tokeniser

PHP port for openai/tiktoken (most)

10422.0k1](/packages/danny50610-bpe-tokeniser)

PHPackages © 2026

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