summaryrefslogtreecommitdiffstatshomepage
path: root/examples/basic_usage.py
blob: 7a4e53dcadd9ebbe1fa4b3ae70351faa0bd52c0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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


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()