diff options
| author | 2025-12-30 19:54:08 +0800 | |
|---|---|---|
| committer | 2025-12-30 19:54:08 +0800 | |
| commit | 575114661ef9afb95df2a211e1d8498686340e6b (patch) | |
| tree | 91f1646cececb1597a9246865e89b52e059d3cfa /src/basemodel/__init__.py | |
| parent | 7ac684f1f82023c6284cd7d7efde11b8dc98c149 (diff) | |
| download | base-model-575114661ef9afb95df2a211e1d8498686340e6b.tar.gz base-model-575114661ef9afb95df2a211e1d8498686340e6b.zip | |
feat: Refactor and enhance TRPG NER model SDK
- Removed deprecated `word_conll_to_char_conll.py` utility and integrated its functionality into the new `utils` module.
- Introduced a comprehensive GitHub Actions workflow for automated publishing to PyPI and GitHub Releases.
- Added `__init__.py` files to establish package structure for `basemodel`, `inference`, `training`, and `utils` modules.
- Implemented model downloading functionality in `download_model.py` to fetch pre-trained ONNX models.
- Developed `TRPGParser` class for ONNX-based inference, including methods for parsing TRPG logs.
- Created training utilities in `training/__init__.py` for NER model training with Hugging Face Transformers.
- Enhanced utility functions for CoNLL file parsing and dataset creation.
- Added command-line interface for converting CoNLL files to datasets with validation options.
Diffstat (limited to 'src/basemodel/__init__.py')
| -rw-r--r-- | src/basemodel/__init__.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/basemodel/__init__.py b/src/basemodel/__init__.py new file mode 100644 index 0000000..7287df4 --- /dev/null +++ b/src/basemodel/__init__.py @@ -0,0 +1,36 @@ +""" +base-model - HydroRoll TRPG NER 模型 SDK + +这是一个用于 TRPG(桌上角色扮演游戏)日志命名实体识别的 Python SDK。 + +基本用法: + >>> from basemodel import TRPGParser + >>> parser = TRPGParser() + >>> result = parser.parse("风雨 2024-06-08 21:44:59 剧烈的疼痛...") + >>> print(result) + {'metadata': {'speaker': '风雨', 'timestamp': '2024-06-08 21:44:59'}, 'content': [...]} + +训练功能(需要额外安装): + >>> pip install base-model[train] + >>> from basemodel.training import train_ner_model + >>> train_ner_model(conll_data="./data", output_dir="./model") +""" + +from basemodel.inference import TRPGParser, parse_line, parse_lines + +try: + from importlib.metadata import version + __version__ = version("base-model") +except Exception: + __version__ = "0.1.0.dev" + +__all__ = [ + "__version__", + "TRPGParser", + "parse_line", + "parse_lines", +] + + +def get_version(): + return __version__ |
