{"id":34020774,"url":"https://github.com/hydroroll-team/conventional_role_play","last_synced_at":"2026-03-10T07:04:58.990Z","repository":{"id":282264512,"uuid":"947304923","full_name":"HydroRoll-Team/conventional_role_play","owner":"HydroRoll-Team","description":"结构化任何文本(大到指令解析, 小到 RolePlay 文案与跑团日志), 并提供规则匹配, 获取任何数据 | Structure any text (from large-scale instruction parsing to small-scale role-playing game scripts and session logs), and provide rule matching to extract any data","archived":false,"fork":false,"pushed_at":"2026-02-03T00:40:16.000Z","size":445,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-03T14:02:55.739Z","etag":null,"topics":["ai","classification","dice","hydroroll","lac","ner","nlp","re","roll"],"latest_commit_sha":null,"homepage":"https://cvrp.hydroroll.team","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HydroRoll-Team.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-12T13:32:28.000Z","updated_at":"2026-02-03T00:40:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"743ccd4f-2808-4811-8602-e2bba472948f","html_url":"https://github.com/HydroRoll-Team/conventional_role_play","commit_stats":null,"previous_names":["hydroroll-team/conventional_role_play"],"tags_count":6,"template":false,"template_full_name":"HydroRoll-Team/pyo3-project-template","purl":"pkg:github/HydroRoll-Team/conventional_role_play","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroRoll-Team%2Fconventional_role_play","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroRoll-Team%2Fconventional_role_play/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroRoll-Team%2Fconventional_role_play/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroRoll-Team%2Fconventional_role_play/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HydroRoll-Team","download_url":"https://codeload.github.com/HydroRoll-Team/conventional_role_play/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroRoll-Team%2Fconventional_role_play/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30326893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ai","classification","dice","hydroroll","lac","ner","nlp","re","roll"],"created_at":"2025-12-13T15:18:30.500Z","updated_at":"2026-03-10T07:04:58.982Z","avatar_url":"https://github.com/HydroRoll-Team.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conventional Role Play\n\n## Overview\n\nConventional Role Play (CVRP) is a Python SDK designed for structured processing of tabletop role-playing game (TRPG) logs. It provides functionalities for parsing logs, extracting rules, and rendering outputs in multiple formats. This SDK aims to streamline the analysis and presentation of TRPG session data.\n\n\u003e **Note**  \n\u003e This documentation is still under construction. Contributions are welcome! See contributing for more information.\n\n## Key Features\n\n* **Rule Extraction**: Easily extract rules from JSON configuration files using the `RuleExtractor` class.\n* **Multi-format Rendering**: Render outputs in various formats such as HTML, Markdown, and JSON using the respective renderer classes (e.g., `HTMLRenderer`).\n* **THULAC Smart Parser**: Intelligent parsing using Tsinghua THULAC (THU Lexical Analyzer for Chinese) for automatic content recognition with minimal configuration. See [THULAC Parser Documentation](docs/THULAC_PARSER.md).\n* **Extensibility**: Create custom plugins to extend the functionality of the SDK. See custom-plugins for details.\n* **Comprehensive API**: Full API documentation available for all modules and classes. See api-documentation.\n\n## Installation\n\nTo install Conventional Role Play, you can use uv or pip:\n\n```bash\nuv add conventionalrp\n```\n\n## Basic Usage\n\n### Traditional Parser (Regex-based)\n\nHere is a simple example of how to use the TRPG Log Processor:\n\n```python\nfrom conventionalrp.core.parser import Parser\nfrom conventionalrp.core.processor import Processor\nfrom conventionalrp.extractors.rule_extractor import RuleExtractor\nfrom conventionalrp.renderers.html_renderer import HTMLRenderer\n\n# Step 1: Load rules\nrule_extractor = RuleExtractor()\nrules = rule_extractor.load_rules('path/to/rules.json')\n\n# Step 2: Parse the log\nparser = Parser(rules)\nparsed_log = parser.parse_log('path/to/log.txt')\n\n# Step 3: Process the parsed tokens\nprocessor = Processor()\noutput = processor.process_tokens(parsed_log)\n\n# Step 4: Render the output\nrenderer = HTMLRenderer()\nhtml_output = renderer.render(output)\n\n# Save or display the output\nwith open('output.html', 'w') as f:\n    f.write(html_output)\n```\n\n### THULAC Smart Parser\n\nSimplified parsing with automatic content recognition:\n\n```python\nfrom conventionalrp.core.thulac_parser import THULACParser\n\n# Step 1: Create parser\nparser = THULACParser(seg_only=False)\n\n# Step 2: Load simplified rules (just delimiters!)\nparser.load_rules('examples/rules/thulac_rules.json5')\n\n# Step 3: Parse a line\ntext = '[15:30] \u003cAlice\u003e \"Hello!\"（waves）'\nresult = parser.parse_line(text)\n\n# Result:\n# {\n#   \"metadata\": {\"timestamp\": \"15:30\", \"speaker\": \"Alice\"},\n#   \"content\": [\n#     {\"type\": \"dialogue\", \"content\": \"Hello!\", \"confidence\": 1.0},\n#     {\"type\": \"action\", \"content\": \"waves\", \"confidence\": 1.0}\n#   ]\n# }\n\n# Step 4: Parse entire log file\nresults = parser.parse_log('path/to/log.txt')\nstats = parser.get_statistics()\nprint(f\"Parsed {stats['total_parsed']} lines\")\n```\n\n## Custom Plugins\n\nTo create a custom plugin, you can follow the example provided in \n\ncustom_plugin.py\n\n. This allows you to add additional processing or rendering capabilities tailored to your needs.\n\n## API Documentation\n\nFor more detailed information on the API and available classes, please refer to the [API documentation](https://crp.hydroroll.team/api.html).\n\n## License\n\nThis project is licensed under the AGPLv3.0 License - see the \n\nLICENSE\n\n file for details.\n\n## Project Links\n\n* [Homepage](https://hydroroll.team/)\n* [Documentation](https://crp.hydroroll.team/)\n* [GitHub Repository](https://github.com/HydroRoll-Team/conventional_role_play)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhydroroll-team%2Fconventional_role_play","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhydroroll-team%2Fconventional_role_play","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhydroroll-team%2Fconventional_role_play/lists"}