markov-strings
Advanced tools
Comparing version 2.0.1 to 2.0.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_1 = require("lodash"); | ||
const debug = require('debug'); | ||
const warn = debug('markov-strings:warning'); | ||
class Markov { | ||
@@ -7,0 +5,0 @@ /** |
{ | ||
"name": "markov-strings", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A Markov string generator", | ||
@@ -39,5 +39,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"debug": "^4.0.1", | ||
"lodash": "^4.17.11" | ||
} | ||
} |
@@ -34,3 +34,3 @@ [![Build Status](https://travis-ci.org/scambier/markov-strings.svg?branch=master)](https://travis-ci.org/scambier/markov-strings) | ||
```js | ||
const Markov = require('markov-strings') | ||
const Markov = require('markov-strings').default | ||
// or | ||
@@ -76,3 +76,3 @@ import Markov from 'markov-strings' | ||
```js | ||
string[] | Array<{ string: string } | ||
string[] | Array<{ string: string }> | ||
``` | ||
@@ -86,3 +86,8 @@ | ||
or | ||
`[ { string: 'lorem ipsum', attr: 'value' }, { string: 'dolor sit amet', attr: 'other value' } ]` | ||
``` | ||
[ | ||
{ string: 'lorem ipsum', attr: 'value' }, | ||
{ string: 'dolor sit amet', attr: 'other value' } | ||
] | ||
``` | ||
@@ -97,3 +102,3 @@ #### options | ||
The `stateSize` is the number of words for each state. `1` will output gibberish sentences without much sense. `2` is a sensible default. `3` and more can create good sentences if you have a corpus that allows it. | ||
The `stateSize` is the number of words for each "link" of the generated sentence. `1` will output gibberish sentences without much sense. `2` is a sensible default for most cases. `3` and more can create good sentences if you have a corpus that allows it. | ||
@@ -105,3 +110,3 @@ ### .buildCorpus() | ||
Since `.buildCorpus()` can take some time, a non-blocking variant `.buildCorpusAsync()` is conveniently available if you need it. | ||
Since `.buildCorpus()` can take some time (it loops for each word of each string), a non-blocking variant `.buildCorpusAsync()` is conveniently available if you need it. | ||
@@ -112,3 +117,3 @@ ### .generate([options]) | ||
```js | ||
```ts | ||
{ | ||
@@ -124,5 +129,8 @@ string: string, // The resulting sentence | ||
Since `.generate()` can potentially take several seconds or more, a non-blocking variant `.generateAsync()` is conveniently available if you need it. | ||
#### options | ||
```js | ||
```ts | ||
{ | ||
@@ -129,0 +137,0 @@ maxTries: number // The max number of tentatives before giving up (default is 10) |
@@ -26,5 +26,2 @@ import { assignIn, cloneDeep, flatten, includes, isEmpty, isString, sample, slice, some, uniqBy } from 'lodash' | ||
const debug = require('debug') | ||
const warn = debug('markov-strings:warning') | ||
export default class Markov { | ||
@@ -31,0 +28,0 @@ public data: Array<{ string: string }> |
35005
1
179
13
694
- Removeddebug@^4.0.1
- Removeddebug@4.3.4(transitive)
- Removedms@2.1.2(transitive)