markov_dart 0.2.0

markov_dart #

A dart library for creating markov chains inspired by otac0n/markov.

Usage #

A simple usage example:

import 'package:markov_dart/markov_dart.dart';

main() {
  var _chain = new MarkovChain<String>(1);

  var items = [
    ["This", "is", "a", "simple", "markov", "chain"],
    ["This", "is", "some", "simple", "magic"],
    ["This", "is", "a", "wild", "ride"]
  ];

  _chain.add(items[0]);
  _chain.add(items[1]);
  _chain.add(items[2]);

  print(_chain.chain(["This"]));

  // generated examples:
  // (is, some, simple, markov, chain)
  // (is, a, simple, magic)
  // (is, a, wild, ride)
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

0.2.0 #

  • Upgrade to Dart 2.0

0.1.0 #

  • Initial version

example/markov_dart_example.dart

// Copyright (c) 2017, 'rinukkusu'. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:markov_dart/markov_dart.dart';

main() {
  var _chain = new MarkovChain<String>(1);

  var items = [
    ["This", "is", "a", "simple", "markov", "chain"],
    ["This", "is", "some", "simple", "magic"],
    ["This", "is", "a", "wild", "ride"]
  ];

  _chain.add(items[0]);
  _chain.add(items[1]);
  _chain.add(items[2]);

  print(_chain.chain(["This"]));

  // generated examples:
  // (is, some, simple, markov, chain)
  // (is, a, simple, magic)
  // (is, a, wild, ride)
}

Use this package as a library

1. Depend on it

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


dependencies:
  markov_dart: ^0.2.0

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_dart/markov_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
67
Overall:
Weighted score of the above. [more]
40
Learn more about scoring.

We analyzed this package on Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/src/markovchain.dart. (-9.08 points)

Analysis of lib/src/markovchain.dart reported 19 hints, including:

line 8 col 50: Unnecessary new keyword.

line 9 col 46: Unnecessary new keyword.

line 13 col 13: Unnecessary new keyword.

line 20 col 25: Unnecessary new keyword.

line 23 col 17: Unnecessary new keyword.

Fix lib/src/chainstate.dart. (-1 points)

Analysis of lib/src/chainstate.dart reported 2 hints:

line 10 col 13: Unnecessary new keyword.

line 13 col 14: Unnecessary new keyword.

Maintenance issues and suggestions

Use analysis_options.yaml. (-10 points)

Change the name of your package's .analysis_options file to analysis_options.yaml.

Read more about the setup of analysis-options.yaml.

Fix .analysis_options.

The analyzer can't parse .analysis_options.

Package is getting outdated. (-22.74 points)

The package was last published 64 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^1.0.0