markov-strings
Advanced tools
Comparing version 1.1.0 to 1.2.0
13
index.js
@@ -15,6 +15,7 @@ 'use strict'; | ||
maxLength: 0, | ||
minWords : 0, | ||
maxWords : 0, | ||
minScore : 0, | ||
maxTries : 10000 | ||
minWords: 0, | ||
maxWords: 0, | ||
minScore: 0, | ||
minScorePerWord: 0, | ||
maxTries: 10000 | ||
}; | ||
@@ -124,2 +125,3 @@ | ||
} | ||
const scorePerWord = parseInt(score/arr.length); | ||
@@ -136,2 +138,3 @@ const sentence = arr.join(' ').trim(); | ||
|| score < options.minScore | ||
|| scorePerWord < options.minScorePerWord | ||
) { | ||
@@ -141,3 +144,3 @@ continue; | ||
return {string: sentence, score: score}; | ||
return {string: sentence, score: score, scorePerWord: scorePerWord}; | ||
} | ||
@@ -144,0 +147,0 @@ |
{ | ||
"name": "markov-strings", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A Markov string generator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,2 +20,3 @@ [![Build Status](https://travis-ci.org/scambier/markov-strings.svg?branch=master)](https://travis-ci.org/scambier/markov-strings) | ||
- [minScore](#minscore) | ||
- [minScorePerWord](#minscoreperword) | ||
- [maxTries](#maxtries) | ||
@@ -88,3 +89,3 @@ - [checker(sentence)](#checkersentence) | ||
{ | ||
string: 'lorem ipsum dolor sit amet (etc.) https://github.com/scambier/markov-strings', | ||
string: 'lorem ipsum dolor sit amet etc. https://github.com/scambier/markov-strings', | ||
score: 42 | ||
@@ -150,2 +151,8 @@ } | ||
##### minScorePerWord | ||
Type: `integer` | ||
Default: `0` | ||
Same as above, but averaged for each word in the returned sentence. | ||
##### maxTries | ||
@@ -167,3 +174,3 @@ Type: `integer` | ||
Return a Promise that will resolve to nothing. | ||
Synced function: `markov.buildCorpusSynced()` | ||
Synced function: `markov.buildCorpusSync()` | ||
@@ -175,3 +182,3 @@ This function **must** be called to build the corpus for Markov generation. | ||
Return a Promise that will resolve to an object `{string, score}` | ||
Synced function: `markov.generateSetnenceSynced()` | ||
Synced function: `markov.generateSentenceSync()` | ||
@@ -178,0 +185,0 @@ ##### options |
@@ -0,0 +0,0 @@ 'use strict'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
277
187
16565