markov 2.0.1+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 52

markov #

Build Status

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

Usage #

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

2.0.1+2 #

  • Apply formatting fixes

2.0.1+1 #

  • Stop CI testing with the dev branch of Dart

2.0.1 #

  • Fix SDK constraints

2.0.0 #

  • Upgrade to Dart 2

1.0.0 #

  • Go from Converter to a StreamConsumer

0.0.1 #

  • 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+2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub 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';
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 Nov 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21


Detected platforms: Flutter, web, other

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


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
quiver ^2.0.0 2.1.2+1
string_scanner ^1.0.3 1.0.5
Transitive dependencies
charcode 1.1.2
matcher 0.12.6
meta 1.1.8
path 1.6.4
source_span 1.5.5
stack_trace 1.9.3
term_glyph 1.1.0
Dev dependencies
test ^1.3.0