@0x77/markov-typescript 中文文档教程

发布于 4年前 浏览 28 项目主页 更新于 3年前

markov-typescript

一个用 TypeScript 编写的马尔可夫链库,灵感来自 otac0n/markovchriscore/MarkovSharp

Getting Started

这些说明将为您提供项目的副本,并在您的本地计算机上运行以用于开发和测试目的。 有关如何在实时系统上部署项目的说明,请参阅部署。

Installing

yarn add @0x77/markov-typescript

Usage

从包中导入类型:

import * as Markov from "@0x77/markov-typescript";

代码示例

const chain = new MarkovChain<string>(2);
chain.learn("the quick brown fox jumped over the lazy dog".split(" "));
chain.learn("the quick brown dog jumped over the lazy cat".split(" "));
chain.learn("the quick brown cat jumped over the lazy fox".split(" "));
for (let x = 0; x < 10; x++) {
  console.log(chain.walk().join(" "));
}

Building the project

yarn build

Versioning

我们使用 SemVer 进行版本控制。 对于可用的版本,请参阅此存储库上的标签

Authors

  • Tom Wolfe - Initial work - trwolfe13
  • Mikahil Marynenko - Dependencies, package optimizations - trwolfe13

另请参阅参与此项目的贡献者列表。

License

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件

Acknowledgments

  • Thanks to otac0n for the original .NET codebase.
  • Thanks to chriscore for the second reference and unit tests.

markov-typescript

A Markov Chain library written in TypeScript, inspired by otac0n/markov and chriscore/MarkovSharp.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installing

yarn add @0x77/markov-typescript

Usage

Import types from package:

import * as Markov from "@0x77/markov-typescript";

Code sample

const chain = new MarkovChain<string>(2);
chain.learn("the quick brown fox jumped over the lazy dog".split(" "));
chain.learn("the quick brown dog jumped over the lazy cat".split(" "));
chain.learn("the quick brown cat jumped over the lazy fox".split(" "));
for (let x = 0; x < 10; x++) {
  console.log(chain.walk().join(" "));
}

Building the project

yarn build

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Tom Wolfe - Initial work - trwolfe13
  • Mikahil Marynenko - Dependencies, package optimizations - trwolfe13

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Thanks to otac0n for the original .NET codebase.
  • Thanks to chriscore for the second reference and unit tests.
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文