PHPackages                             coral-media/ext-ir - 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. coral-media/ext-ir

ActivePhp-ext

coral-media/ext-ir
==================

Information retrieval primitives for PHP

v0.2.0(2mo ago)02↓100%MITCPHP &gt;=8.1

Since Mar 9Pushed 2mo agoCompare

[ Source](https://github.com/coral-media/ext-ir)[ Packagist](https://packagist.org/packages/coral-media/ext-ir)[ RSS](/packages/coral-media-ext-ir/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

coral-media/ext-ir
==================

[](#coral-mediaext-ir)

Information retrieval primitives for PHP.

Build requirements:

- System OpenBLAS is required.
- Linux/macOS: install OpenBLAS development package (for example `libopenblas-dev`).
- Windows: set `OPENBLAS_ROOT` to a prefix containing `include` and `lib\\openblas.lib`.
- Snowball is vendored under `lib/libstemmer` and built as part of the extension.

Install with PIE:

```
# from repository root
cd ext-ir
pie install -j"$(nproc)"
# from packagist
pie install coral-media/ext-ir
```

If OpenBLAS is installed in a non-default location:

```
cd ext-ir
OPENBLAS_PREFIX=/custom/prefix pie install -j"$(nproc)"
```

Build from source (manual):

```
cd ext-ir
phpize
./configure --with-php-config="$(command -v php-config)"
make -j"$(nproc)"
make test
sudo make install
```

Enable extension:

```
extension=ir
```

Windows notes:

- Ensure OpenBLAS is installed and `OPENBLAS_ROOT` points to the prefix.
- Build with the same PHP toolchain version/arch/thread-safety as target PHP.
- Prebuilt libraries availables under Releases section.

Current scaffold (`0.1.0`) includes:

- `ir_version()`
- `CoralMedia\IR\LinearAlgebra::{dot,normL2}()`
- `CoralMedia\IR\Text::{tokenize,stem}()`
- `CoralMedia\IR\Vectorizer::{frequency,vocabulary,fit,transform,fitTransform,tfIdf}()`
- `CoralMedia\IR\Similarity::{pearson,cosine,euclidean,nearest,topK}()`

Usage example:

```
