PHPackages                             opencat/terminology - 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. [Framework](/categories/framework)
4. /
5. opencat/terminology

ActiveLibrary[Framework](/categories/framework)

opencat/terminology
===================

Term recognition and TBX import for the OpenCAT Framework

10PHP

Since May 9Pushed 2mo agoCompare

[ Source](https://github.com/shaikhammar/opencat-terminology)[ Packagist](https://packagist.org/packages/opencat/terminology)[ RSS](/packages/opencat-terminology/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

opencat/terminology
===================

[](#opencatterminology)

Term recognition and TBX import for the [OpenCAT Framework](https://github.com/shaikhammar/opencat-framework).

Parses TBX v2 (ISO 30042) glossary files and stores terms in SQLite. At translation time, scans source text for known terms and returns their target-language equivalents so the translator sees glossary matches alongside TM matches.

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

[](#installation)

```
composer require opencat/terminology
```

Requires `ext-dom`, `ext-intl`, `ext-mbstring`, `ext-pdo`, and `ext-pdo_sqlite`.

Usage
-----

[](#usage)

```
use CatFramework\Terminology\Provider\SqliteTerminologyProvider;

$provider = new SqliteTerminologyProvider('glossary.db');
// SQLite schema is created automatically

// Import a TBX file
$count = $provider->import('legal-terms.tbx');
echo "Imported {$count} term entries";

// Recognise terms in source text
$matches = $provider->recognize(
    text: 'Please review the translation memory for consistency.',
    sourceLanguage: 'en',
    targetLanguage: 'fr',
);

foreach ($matches as $match) {
    echo $match->entry->sourceTerm . ' → ' . $match->entry->targetTerm . PHP_EOL;
    echo "Found at offset {$match->offset}, length {$match->length}" . PHP_EOL;
}
```

TBX parser
----------

[](#tbx-parser)

The `TbxParser` handles both TBX v2 (`` root, ``, ``) and TBX-Basic (`` root, ``, ``):

```
use CatFramework\Terminology\Parser\TbxParser;

$parser = new TbxParser();
$entries = $parser->parseFile('glossary.tbx');   // returns TermEntry[]
// or from a string:
$entries = $parser->parseString($xmlString);
```

Each `TermEntry` carries:

- `$sourceTerm` / `$targetTerm` — the term text
- `$sourceLanguage` / `$targetLanguage` — BCP 47 codes
- `$definition` — extracted from ``
- `$domain` — extracted from ``
- `$forbidden` — `true` when `administrativeStatus` is `deprecatedTerm` or `supersededTerm`

If a concept has multiple terms per language, all source × target combinations are generated as individual `TermEntry` objects.

TBX file example
----------------

[](#tbx-file-example)

```

            translation memory
            A database of previously translated segments.

            mémoire de traduction

```

Term recognition
----------------

[](#term-recognition)

`recognize()` uses Unicode-aware word-boundary detection rather than regex `\b` — which is byte-level and breaks for Arabic and Devanagari. Boundaries are detected using space and punctuation characters, making it safe for Hindi, Urdu, and Arabic terms.

Longer terms are matched preferentially over shorter ones when they overlap (greedy left-to-right scan).

Forbidden terms
---------------

[](#forbidden-terms)

Terms imported with `administrativeStatus = deprecatedTerm` or `supersededTerm` are stored as forbidden. The [`opencat/qa`](https://github.com/shaikhammar/opencat-framework/tree/main/packages/qa) `TerminologyConsistencyCheck` flags target segments that use a forbidden term instead of its approved equivalent.

Related packages
----------------

[](#related-packages)

- [`opencat/core`](https://github.com/shaikhammar/opencat-framework/tree/main/packages/core) — `TermEntry`, `TermMatch`, `TerminologyProviderInterface`, `TerminologyException`
- [`opencat/qa`](https://github.com/shaikhammar/opencat-framework/tree/main/packages/qa) — `TerminologyConsistencyCheck` uses `TerminologyProviderInterface`
- [`opencat/workflow`](https://github.com/shaikhammar/opencat-framework/tree/main/packages/workflow) — wires `SqliteTerminologyProvider` into the pipeline

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance56

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (3 commits)")

### Embed Badge

![Health badge](/badges/opencat-terminology/health.svg)

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

###  Alternatives

[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[alizharb/laravel-modular

A professional, framework-agnostic modular architecture for Laravel 11+. Features zero-config autoloading, 29+ Artisan command overrides, and seamless Vite integration.

211.6k9](/packages/alizharb-laravel-modular)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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