{"id":18377826,"url":"https://github.com/nafeu/topic-weaver","last_synced_at":"2025-07-25T21:10:18.932Z","repository":{"id":211675362,"uuid":"728501701","full_name":"nafeu/topic-weaver","owner":"nafeu","description":"Generate random topic combinations from hierarchical concept maps.","archived":false,"fork":false,"pushed_at":"2023-12-31T04:48:36.000Z","size":636,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T22:57:39.348Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nafeu.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-07T04:28:04.000Z","updated_at":"2023-12-07T04:28:18.000Z","dependencies_parsed_at":"2023-12-29T23:02:03.132Z","dependency_job_id":"8e472d83-32fe-4125-b883-9eab40b08ca5","html_url":"https://github.com/nafeu/topic-weaver","commit_stats":null,"previous_names":["nafeu/topic-weaver"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafeu%2Ftopic-weaver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafeu%2Ftopic-weaver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafeu%2Ftopic-weaver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafeu%2Ftopic-weaver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nafeu","download_url":"https://codeload.github.com/nafeu/topic-weaver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248347224,"owners_count":21088610,"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","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":[],"created_at":"2024-11-06T00:29:24.274Z","updated_at":"2025-04-11T05:29:25.469Z","avatar_url":"https://github.com/nafeu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Topic Weaver\n\n![Version](https://img.shields.io/github/v/tag/nafeu/topic-weaver?label=version)\n![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/nafeu/topic-weaver/tests.yml)\n[![codecov](https://codecov.io/gh/nafeu/topic-weaver/branch/main/graph/badge.svg)](https://codecov.io/gh/nafeu/topic-weaver)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nTopic Weaver lets you generate unique combinations of topics utilizing a hierarchical concept map. Useful for general purpose random text generation, topic combinations, content creation, brainstorming, creative exploration and more.\n\n## Installation\n\n```bash\nnpm install topic-weaver\n```\n\n## Usage\n\n### Import:\n\n```javascript\nconst { weaveTopics } = require('topic-weaver');\n// import { weaveTopics } from 'topic-weaver' // for ESM\n```\n\n### Simple Examples:\n\n\u003e **Pick a meeting leader or notetaker:**\n\n```javascript\nconst { weaveTopics } = require('topic-weaver');\n\nconst conceptMap = `\n  #prompt\n  Today's meeting notetaker is [person].\n\n  #person\n  Erlich\n  Gilfoyle\n  Dinesh\n  Jared\n  Monica\n  Richard\n`;\n\nconst { topics } = weaveTopics(conceptMap, 1);\n\nconsole.log(topics);\n\n/*\n\n(Potential) Result:\n\n\u003e ['Dinesh']\n\n*/\n```\n\n\u003e **Make a list of narrative writing exercises:**\n\n```javascript\nconst { weaveTopics } = require('topic-weaver');\n\nconst conceptMap = `\n  #prompt\n  Write a [length] [genre] about [theme].\n\n  #length\n  1 paragraph\n  2 sentence\n  1 page\n\n  #genre\n  short story\n  poem\n  journal entry\n\n  #theme\n  fantasy battles\n  dystopian societies\n  sci-fi technology\n`;\n\nconst count = 3;\n\nconst { topics } = weaveTopics(conceptMap, count);\n\nconsole.log(topics);\n\n/*\n\n(Potential) Result:\n\n\u003e [\n\u003e   'Write a 1 page poem about dystopian societies.',\n\u003e   'Write a 1 paragraph journal entry about fantasy battles.',\n\u003e   'Write a 2 sentence short story about sci-fi technology.'\n\u003e ]\n\n*/\n```\n\n### Advanced Examples\n\n\u003e **Make a list of social media content ideas:**\n\n```javascript\nconst { weaveTopics } = require('topic-weaver');\n\nconst conceptMap = `\n  #social_media_content_ideas\n  Create [video_style] of [craft] for [platform]\n\n  #craft\n  drawing realistic portraits\n  setting up your studio\n  painting fan requested characters\n\n  #video_style\n  a timelapse\n  a quick before and after look\n  a fast slideshow\n  a single process shot\n\n  #platform\n  instagram\n  youtube\n  tiktok\n`;\n\nconst count = 12;\n\nconst { topics } = weaveTopics(conceptMap, count);\n\nconsole.log(topics.join('\\n'));\n\n/*\n\n(Potential) Result:\n\n\u003e Create a fast slideshow of painting fan requested characters for instagram\n\u003e Create a quick before and after look of setting up your studio for tiktok\n\u003e Create a single process shot of painting fan requested characters for instagram\n\u003e Create a quick before and after look of painting fan requested characters for youtube\n\u003e Create a single process shot of drawing realistic portraits for instagram\n\u003e Create a timelapse of painting fan requested characters for tiktok\n\u003e Create a single process shot of setting up your studio for tiktok\n\u003e Create a timelapse of setting up your studio for instagram\n\u003e Create a single process shot of painting fan requested characters for tiktok\n\u003e Create a quick before and after look of painting fan requested characters for tiktok\n\u003e Create a single process shot of setting up your studio for youtube\n\u003e Create a fast slideshow of setting up your studio for instagram\n\n*/\n```\n\n\u003e **Generate 3d models with matching dimensions:**\n\n```javascript\nconst { weaveTopics } = require('topic-weaver');\n\nconst conceptMap = `\n  #model\n  Construct a [color] [polygon]\n\n  #color\n  red\n  blue\n\n  #polygon\n  cube of [length] x [width] x [height*matching]\n  pyramid of [length] x [width] x [height*matching]\n\n  #length\n  100cm\n  200cm\n  300cm\n\n  #width\n  25cm\n  50cm\n  75cm\n\n  #height\n  200cm\n  300cm\n  400cm\n`;\n\nconst count = 4;\n\nconst { topics } = weaveTopics(conceptMap, count);\n\nconsole.log(topics.join('\\n'));\n\n/*\n\n(Potential) Result:\n\n\u003e Construct a blue pyramid of 100cm x 50cm x 300cm\n\u003e Construct a red pyramid of 300cm x 50cm x 300cm\n\u003e Construct a blue cube of 200cm x 75cm x 300cm\n\u003e Construct a red cube of 200cm x 25cm x 300cm\n\n*/\n```\n\n## Documentation\n\n### Syntax\n\n```\nconst { topics, issues } = weaveTopics(conceptMap, count);\n```\n\n- _**topics**_ is a `string[]` containing a list of generated strings\n- _**issues**_ is a `string[]` containing a list of issues during generation\n- _**conceptMap**_ is a multiline `string` formatted as follows:\n  - `#` followed by a string is a _concept id_\n  - any number of regular strings can be included separated by newlines after a line with `#` which are the results selected when that id is invoked\n  - `[id]` is where a _concept id_ is used to tell the generator how to traverse the tree when generating results\n  - `*` symbol followed by a string within `[]` like `[id*a]` is used to tell the generator to lock in the same value for any other instance of `[id*a]` during generation\n\n### Options\n\n|Option|Type|Description|Syntax\n|-|-|-|-|\n|**strictMode**|_boolean_|Throw an error if an issue occurs during topic generation|`weaveTopics(conceptMap, count, { generatorOptions: { strictMode: true } })`|\n|**delimiter**|_string_|Custom seperator for each id or result string in a concept map (default is `\\n`), note that this symbol cannot be used inside an id or result line|`weaveTopics(conceptMap, count, { parsingOptions: { delimiter: ';' } })`|\n|**idSymbol**|_string_|Custom identifier for an `id` line in a concept map (default is `#`), note that this symbol cannot be used inside the id or a result line|`weaveTopics(conceptMap, count, { parsingOptions: { idSymbol: '$' } })`|\n|**attemptLimit**|_number_|Limit of unique generation attempts before stopping the execution (default is `2000`)|`weaveTopics(conceptMap, count, { generatorOptions: { attemptLimit: 20 } })`|\n|**recursionLimit**|_number_|Limit of recursions occuring during topic generation before stopping execution (default is `2000`)|`weaveTopics(conceptMap, count, { generatorOptions: { recursionLimit: 9999 } })`|\n\n## Development\n\n_Note: `topic-weaver` was developed on Node v20.10.0_\n\n```\ngit clone https://github.com/nafeu/topic-weaver.git\ncd topic-weaver\nnpm install\n```\n\nInstall pre-commit hooks:\n\n```\nnpx husky install\n```\n\nRun tests and coverage with the following commands:\n\n- `npm run test`\n- `npm run test:watch` (to run tests in watch mode)\n- `npm run coverage` (to run tests with coverage report)\n- `npm run coverage:watch` (to run tests with coverage report in watch mode)\n- `npm run coverage:view` (to open coverage report)\n\nLint TypeScript code with:\n\n- `npm run lint`\n\nFormat code with:\n\n- `npm run format` (using prettier)\n\n## Contributing\n\nFeel free to open issues for bugs and feature requests or open pull requests to address them.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnafeu%2Ftopic-weaver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnafeu%2Ftopic-weaver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnafeu%2Ftopic-weaver/lists"}