# alz-predictor

> A JavaScript sequence prediction library, for building proactive and smart user interfaces

Latest version **1.0.1** (published 2021-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install alz-predictor
pnpm add alz-predictor
yarn add alz-predictor
bun add alz-predictor
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-03-24 |
| First published | 2021-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Mudafar E. |
| Maintainers | mudafar |
| Keywords | prediction, sequence, SPA, algorithm, activeLeZi, lz77, adaptive, UI, AI, User Interface |

## Links

- npm: https://www.npmjs.com/package/alz-predictor
- Repository: https://github.com/mudafar/alz-predictor
- Issues: https://github.com/mudafar/alz-predictor/issues
- npm.io page: https://npm.io/package/alz-predictor

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-03-24
- 1.0.0 — 2021-03-24

## README

# ALZ predictor &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mudafar/alz-predictor/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/alz-predictor.svg?style=flat)](https://www.npmjs.com/package/alz-predictor)  ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)

ALZ predictor is a JavaScript library for symbols sequence prediction, based on Gopalratnam and Cook Active LeZi algorithm.


* **AI:** ALZ predictor makes it possible to create proactive and smart UIs. Improve your application UX by adding a touch of artificial intelligence. Guess and prefetch required data to enhance performance. 

* **Simple:** Model each user action as a char, then train ALZ by simply adding them as they come (one by one). Predict next user action at any time. 

* **Lightweight:** No dependencies.   



## Installation
```bash
# Yarn
yarn add alz-predictor

# NPM
npm install --save alz-predictor
```


## Usage

```js
import Predictor from 'alz-predictor'

const predictor = new Predictor()
predictor.add('a')
predictor.add('b')
predictor.add('a')

const predictions = predictor.predict()
```

## Examples
- Prefetch data based on next user action prediction



## Documentation
### Constructor
```js
const predictor = new Predictor()
```

### Methods
- add: add `char` to the sequence.
- predict: get predictions object. 
- loadJSON: recover state from JSON. 

### Serialization
```js
const predictor = new Predictor()
predictor.add('a')
predictor.add('b')

const json = JSON.stringify(predictor)
```


## License
ALZ predictor is [MIT licensed](./LICENSE).

---
_Source: https://npm.io/package/alz-predictor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
