# HanLpServer **Repository Path**: happy3w/han-lp-server ## Basic Information - **Project Name**: HanLpServer - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-26 - **Last Updated**: 2026-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Install ```bash rm -rf .venv # 删除旧的虚拟环境 uv venv --python 3.10 # 基于 Python 3.10 创建新环境 uv sync # 重新同步并安装所有依赖 uv sync --extra-index-url https://download.pytorch.org/whl/cu126 ``` # Run ```bash # 激活虚拟环境(如果尚未激活) source .venv/bin/activate # Linux/Mac # .venv\Scripts\activate # Windows # 直接使用 uv run 运行 uv run python -m hanlp_server.app ``` # Test ```bash curl -X POST http://localhost:5000/extract_triples \ -H "Content-Type: application/json; charset=utf-8" \ -d '{"text": "北京是中国的首都。清华大学位于北京。"}' curl -X POST http://localhost:5000/extract_triples \ -H "Content-Type: application/json; charset=utf-8" \ --data-binary @tests/request.json uv run python -m pytest -vv uv run python -m pytest tests/test_extractor.py::TestTripleExtractor::test_publish_pattern_with_le -v ``` # Demo 演示三元组提取器的效果: ## 展示模式(预设句子) ```bash uv run python -m hanlp_server.demo show ``` 直接展示多个预设句子的三元组提取结果。 ## 交互模式 ```bash uv run python -m hanlp_server.demo ``` 进入交互界面,可以输入任意句子进行三元组提取测试。 - 输入句子后按回车,显示提取结果 - 输入 `quit` 或 `exit` 退出程序 # Develop