Skip to content

Commit

Permalink
documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffordvickrey committed Mar 2, 2020
1 parent 53221a0 commit 4335ff0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ var_dump($output); // e.g. I'd buy that for two dollars!
Command line text generation utilities are also available. For help, run this in your project folder:

```bash
$ php vendor/bin/malarkey
$ ./vendor/bin/malarkey
```

### TextGenerator
### ChainGenerator

#### @generateChain
Generates a Markov chain from source text.
Expand Down
5 changes: 5 additions & 0 deletions bin/malarkey
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use CliffordVickrey\Malarkey\Generator\ChainGenerator;
use CliffordVickrey\Malarkey\Generator\TextGenerator;
use CliffordVickrey\Malarkey\Generator\TextGeneratorOptions;
use CliffordVickrey\Malarkey\MarkovChain\Chain;
use CliffordVickrey\Malarkey\MarkovChain\ChainAbstract;
use CliffordVickrey\Malarkey\MarkovChain\ChainWithoutJsonSupport;

call_user_func(function (array $arguments): void {
Expand Down Expand Up @@ -249,6 +250,10 @@ call_user_func(function (array $arguments): void {
Chain::class,
ChainWithoutJsonSupport::class
]]);

if (!($chain instanceof ChainAbstract)) {
throw new RuntimeException('Failed to unserialize object');
}
} else {
$action = 'generated';
$chainGenerator = new ChainGenerator();
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/TextGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function generateText(ChainInterface $chain, $options = null): string
if ($isLineBreak && '' === $nextWord) {
// two line breaks in a row: let's increment the word count to prevent an infinite loop
$wordCount++;
$maxChunks++;
$chunkCount++;
} else {
$isLineBreak = '' === $nextWord;
if ($isLineBreak) {
Expand Down

0 comments on commit 4335ff0

Please sign in to comment.