markov 1.0.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 50

markov

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.

Changelog

1.0.0

  • Go from Conveter to a StreamConsumer

0.0.1

  • Initial version, created by Stagehand
  • Very limited testing

example/example.dart

// 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:convert';
import 'dart:io';

import 'package:markov/markov.dart';

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.
  var chain = await stdin
      .transform(new Utf8Decoder())
      .transform(new LineSplitter())
      .pipe(new MarkovChainGenerator(2));

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

  print(format(tokens));
}

1. Depend on it

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


dependencies:
  markov: "^1.0.3"

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 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
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

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
50

Platforms

Detected platforms: Flutter, web, other

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
quiver ^0.26.2 0.26.2 0.28.0
string_scanner ^1.0.2 1.0.2
Transitive dependencies
charcode 1.1.1
matcher 0.12.1+4
meta 1.1.2
path 1.5.1
source_span 1.4.0
stack_trace 1.9.1
Dev dependencies
test ^0.12.28