PHPackages                             cywolf/nlp-tools - 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. cywolf/nlp-tools

ActiveTypo3-cms-extension[Utility &amp; Helpers](/categories/utility)

cywolf/nlp-tools
================

Natural Language Processing tools for TYPO3 with language detection, stemming, stop words filtering, and text clustering

2.0.0(4mo ago)22.3k12GPL-2.0-or-laterPHPPHP ^8.1

Since Feb 25Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/friteuseb/nlp_tools)[ Packagist](https://packagist.org/packages/cywolf/nlp-tools)[ RSS](/packages/cywolf-nlp-tools/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (9)Used By (2)

NLP Tools for TYPO3
===================

[](#nlp-tools-for-typo3)

[![TYPO3 12](https://camo.githubusercontent.com/08afacc49187e63c796f7d1c4401d0f0563bab574d9c525312b2827acb09a7c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31322d6f72616e67652e737667)](https://get.typo3.org/version/12)[![TYPO3 13](https://camo.githubusercontent.com/2cf6570821614808899422f68a66a381a2de1dd0746ba9cdba6155def1f4f396/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31332d6f72616e67652e737667)](https://get.typo3.org/version/13)[![TYPO3 14](https://camo.githubusercontent.com/382ff45949671f1b9c4431781f1961eb04a15376fe22523e03a9893c6d4ec278/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31342d6f72616e67652e737667)](https://get.typo3.org/version/14)[![License](https://camo.githubusercontent.com/38cb02326ec18dad84caca7a6ca0f73a2c8d2fd9c4d6c804d8c6ad81c92e7101/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6379776f6c662f6e6c702d746f6f6c732e737667)](https://packagist.org/packages/cywolf/nlp-tools)

A comprehensive TYPO3 extension for Natural Language Processing, compatible with TYPO3 v12, v13 and v14.

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

[](#installation)

```
composer require cywolf/nlp-tools
```

Activate the extension in the TYPO3 extension manager.

Available Features
------------------

[](#available-features)

### 1. Stop Words Management

[](#1-stop-words-management)

Filter stop words in different languages (FR, EN, DE, ES).

```
use Cywolf\NlpTools\Service\StopWordsFactory;

class YourClass {
    protected StopWordsFactory $stopWordsFactory;

    public function __construct(StopWordsFactory $stopWordsFactory)
    {
        $this->stopWordsFactory = $stopWordsFactory;
    }

    public function stopWordsExample(): void
    {
        // Get stop words for a language
        $frenchStopWords = $this->stopWordsFactory->getStopWords('fr');

        // Check if a word is a stop word
        if ($frenchStopWords->isStopWord('le')) {
            // It's a stop word
        }

        // Get the complete list of stop words
        $allStopWords = $frenchStopWords->getStopWords();
    }
}
```

### 2. Language Detection

[](#2-language-detection)

Automatic language detection service based on n-grams.

```
use Cywolf\NlpTools\Service\LanguageDetectionService;

class YourClass {
    protected LanguageDetectionService $languageDetector;

    public function __construct(LanguageDetectionService $languageDetector)
    {
        $this->languageDetector = $languageDetector;
    }

    public function detectionExample(): string
    {
        $text = "This is an example of English text";
        return $this->languageDetector->detectLanguage($text); // Returns 'en'
    }
}
```

### 3. Text Analysis

[](#3-text-analysis)

Complete text analysis service including tokenization, stemming, and removal of stop words.

```
use Cywolf\NlpTools\Service\TextAnalysisService;

class YourClass {
    protected TextAnalysisService $textAnalyzer;

    public function __construct(TextAnalysisService $textAnalyzer)
    {
        $this->textAnalyzer = $textAnalyzer;
    }

    public function analysisExample(): array
    {
        $text = "Here is an example text to analyze";

        // Tokenization
        $tokens = $this->textAnalyzer->tokenize($text);

        // Stemming
        $stemmed = $this->textAnalyzer->stem($text, 'en');

        // Remove stop words
        $withoutStopWords = $this->textAnalyzer->removeStopWords($text, 'en');

        return [
            'tokens' => $tokens,
            'stemmed' => $stemmed,
            'cleaned' => $withoutStopWords
        ];
    }
}
```

### 4. Text Vectorization

[](#4-text-vectorization)

Service for converting text into vector representations for machine learning.

```
use Cywolf\NlpTools\Service\TextVectorizerService;

class YourClass {
    protected TextVectorizerService $vectorizer;

    public function __construct(TextVectorizerService $vectorizer)
    {
        $this->vectorizer = $vectorizer;
    }

    public function vectorizationExample(): array
    {
        $texts = [
            "This is the first document to analyze",
            "A second document with different content",
            "And finally a third example"
        ];

        // Create TF-IDF vectors
        $tfIdfData = $this->vectorizer->createTfIdfVectors($texts, 'en');

        // Create document-term matrix
        $dtmData = $this->vectorizer->createDocumentTermMatrix($texts, 'en');

        // Calculate similarity between two vectors
        $similarity = $this->vectorizer->cosineSimilarity(
            $tfIdfData['vectors'][0],
            $tfIdfData['vectors'][1]
        );

        // Calculate similarity matrix
        $similarityMatrix = $this->vectorizer->calculateSimilarityMatrix($tfIdfData['vectors']);

        return [
            'tfidf' => $tfIdfData,
            'dtm' => $dtmData,
            'similarity' => $similarity,
            'matrix' => $similarityMatrix
        ];
    }
}
```

### 5. Text Clustering

[](#5-text-clustering)

Service for automatically grouping similar texts together.

```
use Cywolf\NlpTools\Service\TextClusteringService;

class YourClass {
    protected TextClusteringService $clustering;

    public function __construct(TextClusteringService $clustering)
    {
        $this->clustering = $clustering;
    }

    public function clusteringExample(): array
    {
        $texts = [
            "The cat sleeps on the couch",
            "My dog plays in the garden",
            "I like cats and domestic felines",
            "The dog is man's best friend",
            "Pets bring joy"
        ];

        // K-means clustering (k=2 groups)
        $kMeansClusters = $this->clustering->kMeansClustering($texts, 2, 'en');

        // Hierarchical clustering
        $hierarchicalClusters = $this->clustering->hierarchicalClustering(
            $texts,
            0.6, // Distance threshold
            'en'
        );

        // Similarity-based clustering
        $similarityClusters = $this->clustering->similarityBasedClustering(
            $texts,
            0.7, // Similarity threshold
            'en'
        );

        return [
            'kmeans' => $kMeansClusters,
            'hierarchical' => $hierarchicalClusters,
            'similarity' => $similarityClusters
        ];
    }
}
```

### 6. Topic Modeling

[](#6-topic-modeling)

Service for extracting themes and topics from text collections.

```
use Cywolf\NlpTools\Service\TopicModelingService;

class YourClass {
    protected TopicModelingService $topicModeling;

    public function __construct(TopicModelingService $topicModeling)
    {
        $this->topicModeling = $topicModeling;
    }

    public function topicsExample(): array
    {
        $texts = [
            "The new economic policy favors local businesses",
            "The government announces an economic recovery plan",
            "Researchers have discovered a new medical treatment",
            "A scientific study reveals the impact of climate on health",
            "The stock market saw a strong rise following economic announcements"
        ];

        // Extract topics
        $topics = $this->topicModeling->extractTopics(
            $texts,
            2, // Number of topics to extract
            5  // Number of terms per topic
        );

        // Extract representative terms from a group of texts
        $terms = $this->topicModeling->extractTopicTerms(
            $texts,
            10 // Number of terms to extract
        );

        // Extract key phrases from a text
        $keyPhrases = $this->topicModeling->extractKeyPhrases(
            $texts[0],
            3 // Number of phrases to extract
        );

        return [
            'topics' => $topics,
            'terms' => $terms,
            'key_phrases' => $keyPhrases
        ];
    }
}
```

Example of use in a TYPO3 extension
-----------------------------------

[](#example-of-use-in-a-typo3-extension)

### Services.yaml configuration

[](#servicesyaml-configuration)

```
services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  YourVendor\YourExtension\:
    resource: '../Classes/*'

  YourVendor\YourExtension\Service\TextProcessingService:
    public: true
```

### Service class

[](#service-class)

```
namespace YourVendor\YourExtension\Service;

use Cywolf\NlpTools\Service\TextAnalysisService;
use Cywolf\NlpTools\Service\LanguageDetectionService;
use Cywolf\NlpTools\Service\TextClusteringService;
use Cywolf\NlpTools\Service\TopicModelingService;

class TextProcessingService
{
    protected TextAnalysisService $textAnalyzer;
    protected LanguageDetectionService $languageDetector;
    protected TextClusteringService $clustering;
    protected TopicModelingService $topicModeling;

    public function __construct(
        TextAnalysisService $textAnalyzer,
        LanguageDetectionService $languageDetector,
        TextClusteringService $clustering,
        TopicModelingService $topicModeling
    ) {
        $this->textAnalyzer = $textAnalyzer;
        $this->languageDetector = $languageDetector;
        $this->clustering = $clustering;
        $this->topicModeling = $topicModeling;
    }

    public function processText(string $text): array
    {
        // Language detection
        $language = $this->languageDetector->detectLanguage($text);

        // Complete analysis
        return [
            'language' => $language,
            'tokens' => $this->textAnalyzer->tokenize($text),
            'stemmed' => $this->textAnalyzer->stem($text, $language),
            'without_stopwords' => $this->textAnalyzer->removeStopWords($text, $language),
            'key_phrases' => $this->topicModeling->extractKeyPhrases($text, 3, $language)
        ];
    }

    public function analyzeMultipleTexts(array $texts): array
    {
        // Clustering and topic analysis
        $clusters = $this->clustering->kMeansClustering($texts, 3);
        $topics = $this->topicModeling->extractTopics($texts, 3);

        return [
            'clusters' => $clusters,
            'topics' => $topics
        ];
    }
}
```

Using with cache
----------------

[](#using-with-cache)

To improve performance, you can inject a TYPO3 cache into the services:

```
use TYPO3\CMS\Core\Cache\CacheManager;
use Cywolf\NlpTools\Service\TextAnalysisService;

class YourController
{
    protected TextAnalysisService $textAnalyzer;
    protected CacheManager $cacheManager;

    public function __construct(
        TextAnalysisService $textAnalyzer,
        CacheManager $cacheManager
    ) {
        $this->textAnalyzer = $textAnalyzer;
        $this->cacheManager = $cacheManager;
    }

    public function yourAction(): void
    {
        // Get the cache
        $cache = $this->cacheManager->getCache('nlp_tools');

        // Pass it to a service for faster calculations
        $this->textAnalyzer->setCache($cache);

        // Use the service normally
        $tokens = $this->textAnalyzer->tokenize($text);
    }
}
```

TYPO3 Compatibility
-------------------

[](#typo3-compatibility)

This extension is compatible with:

- TYPO3 v12.4+
- TYPO3 v13.0+
- TYPO3 v14.0+

**PHP Requirements:** PHP 8.1 or higher

Important Notes
---------------

[](#important-notes)

- Language detection uses TYPO3 language configuration if available
- Stemming uses a simplified internal implementation, with fallback to the Snowball library
- Services can be injected via TYPO3's dependency injection
- Clustering algorithms are optimized for acceptable performance even on large text collections
- Use caching to improve performance on repetitive operations

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance74

Regular maintenance activity

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% 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 ~46 days

Recently: every ~69 days

Total

7

Last Release

145d ago

Major Versions

1.3.1 → 2.0.02025-12-24

PHP version history (3 changes)1.0.0PHP &gt;=8.2

1.1.0PHP &gt;=8.1

2.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1471455?v=4)[Cyril Wolfangel](/maintainers/friteuseb)[@friteuseb](https://github.com/friteuseb)

---

Top Contributors

[![friteuseb](https://avatars.githubusercontent.com/u/1471455?v=4)](https://github.com/friteuseb "friteuseb (10 commits)")[![cyril-wolfangelTalanCOP](https://avatars.githubusercontent.com/u/220198517?v=4)](https://github.com/cyril-wolfangelTalanCOP "cyril-wolfangelTalanCOP (6 commits)")

### Embed Badge

![Health badge](/badges/cywolf-nlp-tools/health.svg)

```
[![Health](https://phpackages.com/badges/cywolf-nlp-tools/health.svg)](https://phpackages.com/packages/cywolf-nlp-tools)
```

###  Alternatives

[eliashaeussler/typo3-form-consent

Extension for TYPO3 CMS that adds double opt-in functionality to EXT:form

1481.0k](/packages/eliashaeussler-typo3-form-consent)[b13/assetcollector

Add CSS and SVG files and strings as inline style tag/inline svg to the html code.

10118.4k](/packages/b13-assetcollector)[mfd/ai-filemetadata

Automatically generates FAL metadata for files by means of public LLMs

1142.1k](/packages/mfd-ai-filemetadata)[mautic/mautic-typo3

Add-on TYPO3 extension that enhances the "EXT:marketing\_automation" TYPO3 extension by connecting it to the Mautic Marketing Automation platform: Determine "Persona" from Mautic segments. Also provides additional services e.g. language synchronisation between Mautic and TYPO3.

236.3k](/packages/mautic-mautic-typo3)

PHPackages © 2026

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