{"id":19689937,"url":"https://github.com/jthistle/markov","last_synced_at":"2026-05-10T20:40:54.616Z","repository":{"id":49771374,"uuid":"196818032","full_name":"jthistle/markov","owner":"jthistle","description":"A compiling markov generator for JS","archived":false,"fork":false,"pushed_at":"2021-06-10T01:30:21.000Z","size":97,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T10:42:53.024Z","etag":null,"topics":["generator","javascript","markov","npm-package"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jthistle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-14T09:33:18.000Z","updated_at":"2019-07-26T12:56:06.000Z","dependencies_parsed_at":"2022-08-31T11:14:05.268Z","dependency_job_id":null,"html_url":"https://github.com/jthistle/markov","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jthistle/markov","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthistle%2Fmarkov","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthistle%2Fmarkov/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthistle%2Fmarkov/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthistle%2Fmarkov/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jthistle","download_url":"https://codeload.github.com/jthistle/markov/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthistle%2Fmarkov/sbom","scorecard":{"id":539996,"data":{"date":"2025-08-11","repo":{"name":"github.com/jthistle/markov","commit":"f82aa48eedb0b8ae1038753b3b98a7f40cd559ab"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"12 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T07:58:25.839Z","repository_id":49771374,"created_at":"2025-08-20T07:58:25.839Z","updated_at":"2025-08-20T07:58:25.839Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285681625,"owners_count":27213755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-21T02:00:06.175Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","javascript","markov","npm-package"],"created_at":"2024-11-11T19:03:43.217Z","updated_at":"2025-11-21T20:03:20.136Z","avatar_url":"https://github.com/jthistle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compiled Markov\n\nA Markov generator module for JS with support for compilation.\n\n\n## Installation\n\nThis package is available through `npm` as [`compiled-markov`](https://www.npmjs.com/package/compiled-markov).\n\nHere is an example of how to use it:\n\n```javascript\nconst Markov = require(\"compiled-markov\")\nconst fs = require(\"fs\")\n\n// Read our source file\nfs.readFile(\"./source.txt\", \"utf8\", (error, data) =\u003e runProgram(data))\n\nconst runProgram = (source) =\u003e {\n  const mark = new Markov()\n\n  // Give the generator the source\n  mark.initFromText(source)\n\n  // Let's get some markov sentences! Make them start with 'fear'.\n  console.log(mark.generateSentences(3, \"fear\"))\n\n  // Give us the compiled JSON and write it to a file which we can\n  // read later in our production product\n  const compiled = mark.getCompiled()\n  fs.writeFile(\"./compiled.txt\", compiled, \"utf8\", (error) =\u003e console.log(error))\n}\n```\n\nPretty simple, huh?\n\nIn other JS environments, such as web platforms like React, you can pass a string to `initFromText`, or work out your own way of fetching and opening a text file. It can be a bit more difficult, since `fs` isn't supported in Node when it's run for browser applications. \n\n`wells-source.txt` is provided as an example source file, taken from [Project Gutenburg](http://www.gutenberg.org/files/36/36-h/36-h.htm). This work (_The War of the Worlds_, H.G. Wells, 1897) is public domain - in the UK, at least.\n\n### Why 'compiled'?\n\nYou only have to feed in a source text once for this to work. All the data needed to generate sentences will then be in a compiled string that bears little resemblence to the original text. This means, you can run this locally to read from a source, and then only track and generate sentences from the compiled JSON.\n\nThis can be useful if you want to use copyrighted text to generate the Markov chain. Since it isn't the original text when written in this form, it's legal, probably. \n\n**DISCLAIMER: no responsibility can be accepted by any contributors to this programme for any\nlegal issues, including but not limited to copyright issues, that result through the use of\nthis programme.**\n\n## Usage\n\n### Initialisation\n\n#### `initFromText(text): [no return value]`\n\n- `text`: `string`, the source text string\n\nThe generator will generate a new markov chain from the source text provided.\n\n#### `initFromCompiled(compiled): [no return value]`\n\n- `compiled`: `string` or `Object`, the compiled JSON\n\nThe generator will try to generate a new markov chain from the compiled JSON passed to it.\n\n### Compilation\n\n#### `getCompiled(): string`\n\nReturns the compiled JSON that can be passed back into `initFromCompiled`.\n\n### Generation\n\n#### `generateSentences(count, seed): string`\n\n- `count`: `int`, the number of sentences to generate\n- `seed`: `string` (optional, default: `undefined`), the word to seed the sentence from\n\nRandomly generate `count` sentences. `seed` can be used to choose how to start off\ngeneration - it will be the first word of the generated sentences. `seed` is case sensitive.\n\n## Contributing\n\nPlease, fork and make a pull request. Or, just make an issue. My JS is less than elegant, and I'm always interested to learn new and improved ways of doing things.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjthistle%2Fmarkov","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjthistle%2Fmarkov","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjthistle%2Fmarkov/lists"}