4.0.0 • Published 11 months ago

kurwov v4.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

API

Generating a dataset.

import { MarkovData } from 'kurwov';
const sentences = ['i love hamburgers', 'i love cats'];
const chain = new MarkovChain(sentences);

Using your dataset to generate a sentence.

chain.generate(); // i love hamburgers or i love cats

Adding an sentence to the dataset.

chain.add('i love dogs');

Completing a sentence.

chain.complete({ data, start: 'i love' }); // i love dogs, i love hamburgers, or i love cats

Comparison

Featurekurwovmarkov-typescriptmarkov-generatormarkov-stringsmarkov-chainsmrkv
Dependency-free✔️✔️✔️
Typings✔️❌ (incorrect)✔️
Generating sentences✔️✔️✔️✔️❌ (errors)❌ (errors)
Completing sentences✔️✔️
Higher statesize support✔️✔️✔️
Adding stuff other than strings✔️✔️
Total package size16.6KB1.4MB7.9KB*1.4MB51KB20KB

If you use markov chains to generate sentences, kurwov is far better than other libraries. It's the fastest and smallest package in the comparison, and has typings. * While markov-generator is only 7.9KB, it doesn't include ESM support and doesn't include typings. It also doesn't support higher statesizes which results in less code.

Speed

Benchmarks ran on a 6c/12t AMD Ryzen 5 5600 @ 4.45GHz with 32gb ddr4 3200mhz RAM on Ubuntu through WSL2 with Node.js v22.5.1 Using data from amazon q/a dataset, using the first n (10k or 100k) answers from the electronics dataset.

kurwov speed compared to other markov packages

Benchmarkkurwovmarkov-typescriptmarkov-generatormarkov-stringsmarkov-chains, foswig, mrkv
Generating a dataset with 10000 sentences.64.30ms458.90ms127.63ms1507.75msN/A (errored)
Generating a dataset with 100000 sentences.1046.55ms5815.11ms8844.53ms78044.7619msN/A (errored)

kurwov speed compared to other markov packages with higher statesize

Benchmark | kurwov | markov-typescript | markov-strings Generating a dataset with 10000 sentences. | 182.08ms | 702.25ms | 1349.19ms Generating a dataset with 100000 sentences. | 3481.44ms | 10154.96ms | 77600.49ms

4.0.0

11 months ago

3.2.6

1 year ago

3.2.5

1 year ago

3.2.4

3 years ago

3.2.3

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.0

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago