markov 2.0.1+1

  • Example
  • Installing
  • Versions
  • 54


Build Status

A simple Markov chain implementation. Generates words and punctuation. Tuned for tweets.


Look at example/stdin_example.dart for a simple way of generating new text based on text provided through POSIX standard input.


  • Stop CI testing with the dev branch of Dart


  • Fix SDK constraints


  • Upgrade to Dart 2


  • Go from Converter to a StreamConsumer


  • Initial version, created by Stagehand
  • Very limited testing


// Copyright (c) 2016, <your name>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library markov.example;

import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:markov/markov.dart';

Future<void> main() async {
  print('Provide source text by stdin. For best result, provide a large number '
      'of tweets, one per line.\n\n'
      '  \$ dart example.dart < tweets.txt\n'
      '  Here\'s your generated tweet.');

  // Take POSIX standard input stream (or any other byte
  // stream) and use it as source text.
  final chain = await stdin
      .transform(const Utf8Decoder())
      .transform(const LineSplitter())

  // Take just one tweet worth of generated content (terminated by a newline).
  final List<Token> tokens =
      chain.generate().takeWhile((token) => token.string != '\n').toList();


Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  markov: ^2.0.1+1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:markov/markov.dart';
Version Uploaded Documentation Archive
2.0.1+1 Oct 16, 2018 Go to the documentation of markov 2.0.1+1 Download markov 2.0.1+1 archive
2.0.1 Aug 6, 2018 Go to the documentation of markov 2.0.1 Download markov 2.0.1 archive
2.0.0 Jul 23, 2018 Go to the documentation of markov 2.0.0 Download markov 2.0.0 archive
1.0.3 Nov 23, 2017 Go to the documentation of markov 1.0.3 Download markov 1.0.3 archive
1.0.2 Nov 23, 2017 Go to the documentation of markov 1.0.2 Download markov 1.0.2 archive
1.0.1 Mar 10, 2016 Go to the documentation of markov 1.0.1 Download markov 1.0.1 archive
1.0.0 Mar 9, 2016 Go to the documentation of markov 1.0.0 Download markov 1.0.0 archive
0.1.0 Mar 9, 2016 Go to the documentation of markov 0.1.0 Download markov 0.1.0 archive
0.0.2 Mar 8, 2016 Go to the documentation of markov 0.0.2 Download markov 0.0.2 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 16, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:markov/markov.dart.

Health suggestions

Format lib/src/chain.dart.

Run dartfmt to format lib/src/chain.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
quiver ^2.0.0 2.0.0+1
string_scanner ^1.0.3 1.0.4
Transitive dependencies
charcode 1.1.2
matcher 0.12.4
meta 1.1.6
path 1.6.2
source_span 1.4.1
stack_trace 1.9.3
Dev dependencies
test ^1.3.0