diff options
| author | 2025-03-13 01:01:20 +0800 | |
|---|---|---|
| committer | 2025-03-13 01:01:20 +0800 | |
| commit | 80b74f79dfbfa9afb845172a5ea84110d75f1bc8 (patch) | |
| tree | 361dcb055de78b50d82619646fde28fa618f9507 /examples/basic_usage.py | |
| parent | dd873e954a92d0e3209fe98b034570b47c859589 (diff) | |
| download | conventional_role_play-80b74f79dfbfa9afb845172a5ea84110d75f1bc8.tar.gz conventional_role_play-80b74f79dfbfa9afb845172a5ea84110d75f1bc8.zip | |
refactor(project)!: first implementation of the Conventional Role Play SDK with core components, renderers, extractors, and example usage.
Diffstat (limited to 'examples/basic_usage.py')
| -rw-r--r-- | examples/basic_usage.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/basic_usage.py b/examples/basic_usage.py new file mode 100644 index 0000000..e2209da --- /dev/null +++ b/examples/basic_usage.py @@ -0,0 +1,31 @@ +from trpg_log_processor.core.parser import Parser +from trpg_log_processor.core.processor import Processor +from trpg_log_processor.extractors.rule_extractor import RuleExtractor +from trpg_log_processor.renderers.html_renderer import HTMLRenderer + +def main(): + # Initialize the parser and load rules + parser = Parser() + parser.load_rules('path/to/rules.json') + + # Parse the TRPG log + log_data = "Your TRPG log data here" + parsed_tokens = parser.parse_log(log_data) + + # Initialize the rule extractor + extractor = RuleExtractor() + rules = extractor.extract('path/to/rules.json') + + # Process the parsed tokens + processor = Processor() + processed_data = processor.process_tokens(parsed_tokens, rules) + + # Render the output in HTML format + renderer = HTMLRenderer() + output = renderer.render(processed_data) + + # Print or save the output + print(output) + +if __name__ == "__main__": + main()
\ No newline at end of file |
