Skip to main content

Conventional Role Play

Overview

Conventional 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.

Note
This documentation is still under construction. Contributions are welcome! See contributing for more information.

Key Features

  • Rule Extraction: Easily extract rules from JSON configuration files using the RuleExtractor class.
  • Multi-format Rendering: Render outputs in various formats such as HTML, Markdown, and JSON using the respective renderer classes (e.g., HTMLRenderer).
  • THULAC Smart Parser: 🆕 Intelligent parsing using Tsinghua THULAC (THU Lexical Analyzer for Chinese) for automatic content recognition with minimal configuration. See THULAC Parser Documentation.
  • Extensibility: Create custom plugins to extend the functionality of the SDK. See custom-plugins for details.
  • Comprehensive API: Full API documentation available for all modules and classes. See api-documentation.

Installation

To install Conventional Role Play, you can use pip:

pip install conventionalrp

Basic Usage

Traditional Parser (Regex-based)

Here is a simple example of how to use the TRPG Log Processor:

from conventionalrp.core.parser import Parser
from conventionalrp.core.processor import Processor
from conventionalrp.extractors.rule_extractor import RuleExtractor
from conventionalrp.renderers.html_renderer import HTMLRenderer

# Step 1: Load rules
rule_extractor = RuleExtractor()
rules = rule_extractor.load_rules('path/to/rules.json')

# Step 2: Parse the log
parser = Parser(rules)
parsed_log = parser.parse_log('path/to/log.txt')

# Step 3: Process the parsed tokens
processor = Processor()
output = processor.process_tokens(parsed_log)

# Step 4: Render the output
renderer = HTMLRenderer()
html_output = renderer.render(output)

# Save or display the output
with open('output.html', 'w') as f:
    f.write(html_output)

THULAC Smart Parser

Simplified parsing with automatic content recognition:

from conventionalrp.core.thulac_parser import THULACParser

# Step 1: Create parser
parser = THULACParser(seg_only=False)

# Step 2: Load simplified rules (just delimiters!)
parser.load_rules('examples/rules/thulac_rules.json5')

# Step 3: Parse a line
text = '[15:30] <Alice> "Hello!"(waves)'
result = parser.parse_line(text)

# Result:
# {
#   "metadata": {"timestamp": "15:30", "speaker": "Alice"},
#   "content": [
#     {"type": "dialogue", "content": "Hello!", "confidence": 1.0},
#     {"type": "action", "content": "waves", "confidence": 1.0}
#   ]
# }

# Step 4: Parse entire log file
results = parser.parse_log('path/to/log.txt')
stats = parser.get_statistics()
print(f"Parsed {stats['total_parsed']} lines")

Custom Plugins

To create a custom plugin, you can follow the example provided in

custom_plugin.py

. This allows you to add additional processing or rendering capabilities tailored to your needs.

API Documentation

For more detailed information on the API and available classes, please refer to the API documentation.

License

This project is licensed under the AGPLv3.0 License - see the

LICENSE

file for details.

Release files for conventionalrp 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for conventionalrp 1.2.1
File Size Uploaded
conventionalrp-1.2.1.tar.gz 194.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for conventionalrp 1.2.1
File
conventionalrp-1.2.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
conventionalrp-1.2.1-cp39-abi3-win32.whl CPython 3.9 abi3 Windows x86-32 Details
conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_i686.whl CPython 3.9 abi3 Linux musl 1.2+ x86-32 Details
conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_armv7l.whl CPython 3.9 abi3 Linux musl 1.2+ ARMv7l Details
conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.9 abi3 Linux glibc 2.17+ IBM System/390x Details
conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.9 abi3 Linux glibc 2.17+ PowerPC 64-le Details
conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.9 abi3 Linux glibc 2.17+ ARMv7l Details
conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
conventionalrp-1.2.1-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl CPython 3.9 abi3 Linux glibc 2.5+ x86-32 Details
conventionalrp-1.2.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
conventionalrp-1.2.1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 14.8 MB

Release files / conventionalrp-1.2.1.tar.gz

Download URL conventionalrp-1.2.1.tar.gz
Size 194.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6f3284841486b6cebc5482c206e952d8d35307239b26d084b4c8fc9b840a7fa7
BLAKE2b-256 checksum
How to use checksums
81971d589601f5c078c677a91e9c114a0231df70d7dbbe634dbc07ee24a925d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-win_amd64.whl

Download URL conventionalrp-1.2.1-cp39-abi3-win_amd64.whl
Size 777.2 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8d4b725fcb838ad36f4be0709dedf168aa95f0c142b82e7e2fe7bae37b6af7df
BLAKE2b-256 checksum
How to use checksums
18be3a3a1df7abd6e64d8f9e607505cce76fd3a2aeb3cd76ef12d0f067e635ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-win32.whl

Download URL conventionalrp-1.2.1-cp39-abi3-win32.whl
Size 706.2 kB
Tags CPython 3.9 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
6b963a06f8e12899f1c09517bd62267b25055e07833563b5969377045aeaf074
BLAKE2b-256 checksum
How to use checksums
e818ac3c0dbb7d7c1455446e09791ace6ea25af19ef132761a7466679c45c4fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
87d7badbb8b65fb159ea29a3e9c76a5ffe3a892af2ef167839d842179236efcc
BLAKE2b-256 checksum
How to use checksums
e98a1d5e46452e6c3242bd2ffa63082d6d0e0f4b3058fc18264cf7148a06b31d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_i686.whl

Download URL conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_i686.whl
Size 1.2 MB
Tags CPython 3.9 Linux musl 1.2+ x86-32 abi3
SHA-256 checksum
How to use checksums
e48fbbb6b491399885e35adbb218c2652a4dd59bd3d53dbfbddd73e78eca2823
BLAKE2b-256 checksum
How to use checksums
ded03711f4c32dbf66fe320a82c81d4c3094fede4de5e88c816d5b3a4790344d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_armv7l.whl

Download URL conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_armv7l.whl
Size 1.2 MB
Tags CPython 3.9 Linux musl 1.2+ ARMv7l abi3
SHA-256 checksum
How to use checksums
2152c49fe5572b313e2c8f60522e2f5f226ba797255927fe8446100359759117
BLAKE2b-256 checksum
How to use checksums
2c0b42c4679891bf22140100854c0c2045758d9d190c6796ec8abdfa35ed5692
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL conventionalrp-1.2.1-cp39-abi3-musllinux_1_2_aarch64.whl
Size 1.2 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
1dc93579bdefbcc5abcf6667cc1966e65a6dee7e33bde8046eec0de2c3c1726e
BLAKE2b-256 checksum
How to use checksums
b9ad291c5d99d1682ea6eae859694def25590b7a663be10c687da1c9267cc096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.0 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4d2adab7d2c92d9d428e88442170779c37620b7748cb47a6919e5538c50afa3a
BLAKE2b-256 checksum
How to use checksums
5bd0d3b64ada27bbec93810e0dc589156f96322ed137b9f331e6801c5843ee57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 1.1 MB
Tags CPython 3.9 Linux glibc 2.17+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
1924bcb501bd0e275428f8d72f035bcb46c27b5aab00ef48a118bf5d16ad4bdd
BLAKE2b-256 checksum
How to use checksums
4c6be97ec640ccc32dca589f4503ce2a66b03586e8ec099e3a33be38d42aeed2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
dc2b7d2bbea322b003b4e9e7ee3093e789d655357ec5a2ebb9c0a20e5becc441
BLAKE2b-256 checksum
How to use checksums
e5d24f5f471185a7d7543934d4ff1a909bcc0a4c394422d81de93c6d4bcb3ba7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 966.6 kB
Tags CPython 3.9 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
14e8fb81f8bdf62026ef6543542ba0e93a63f480f59d9d7bcbe7b6313d9821eb
BLAKE2b-256 checksum
How to use checksums
67a12dd3228d237cee44286ac240e51508c13eda84631e1010879f4aca0f88d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL conventionalrp-1.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.0 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
abe319ea96045b1f202b2f28d62820ef4c6a341585b455b1a726eeb550d1ce38
BLAKE2b-256 checksum
How to use checksums
1cbfc25bdeab157612d46f1400c60cb204b3d241df858b34078b6e0aec86fea3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl

Download URL conventionalrp-1.2.1-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Size 1.1 MB
Tags CPython 3.9 Linux glibc 2.5+ x86-32 abi3
SHA-256 checksum
How to use checksums
9d7ad22cf2f8527c778592cc85e4a7cfe02a077b774f75a336efd751e27bd149
BLAKE2b-256 checksum
How to use checksums
4c960977703c4fc5c5da5fd4b6c975e55c1f75846b8c6dd4aee6b30559626378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL conventionalrp-1.2.1-cp39-abi3-macosx_11_0_arm64.whl
Size 892.7 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7d02044bb12b732fe080be0bfde3fcb11b16b643c4a73c5d37ce8ee1aac3c9d2
BLAKE2b-256 checksum
How to use checksums
335d68feb6a8b75821de10e07ef7bd210402fcbe637f9bb9d9656f6af4faed93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / conventionalrp-1.2.1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL conventionalrp-1.2.1-cp39-abi3-macosx_10_12_x86_64.whl
Size 951.0 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4b4a7d356e0171b1e89903ee1ee142d868be96524799c0982d6a57d7aff03848
BLAKE2b-256 checksum
How to use checksums
3fb094c448d24c13cc738a5b22616b4587839919d5b95a530a9a23b571e23621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release history Release notifications | RSS feed

This release

1.2.1 This release

15 release files

1.2.0

15 release files

0.2.3

15 release files

0.2.2

15 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page