/mjlog2mjai

Convert Tenhou MJLOG XML to MJAI Json.

Primary LanguagePythonMIT LicenseMIT

Tenhou mjlog to MJAI Event Json

Convert Tenhou MJLOG XML to MJAI Json format directly, instead of querying https://tenhou.net/5/mjlog2json.cgi?{log_id} slowly.

Usage

from .parse import load_mjlog, parse_mjlog_to_mjai
mjai_data = parse_mjlog_to_mjai(load_mjlog("xx.mjlog"))

Compatibility and known issues

Checked on ~2000 games, mostly matched with mjai-reviewer. See test.py, where check/ contains the tenhou official site unzipped file.

The only differences are kakans with akari dora: the order they appeared in consumed field is decided by mjlog2json.cgi and seems arbitrary (or I didn't understand the encoding correctly), so I left it unfixed.

Acknowledgement

Parser was originally from tenhou-log-utils. Hence this repository is also under the MIT license.