Skip to main content

aiwolf-nlp-common

Project description

aiwolf-nlp-common

人狼知能コンテスト(自然言語部門) のエージェント向けの共通パッケージです。
ゲームサーバから送信されるJSON形式のデータをオブジェクトに変換するためのパッケージです。

import json

from aiwolf_nlp_common.packet import Packet

value = """{"request":"INITIALIZE","info":{"day":0,"agent":"Agent[01]","statusMap":{"Agent[01]":"ALIVE","Agent[02]":"ALIVE","Agent[03]":"ALIVE","Agent[04]":"ALIVE","Agent[05]":"ALIVE"},"roleMap":{"Agent[01]":"WEREWOLF"}},"setting":{"playerNum":5,"maxTalk":5,"maxTalkTurn":20,"maxWhisper":5,"maxWhisperTurn":20,"maxSkip":0,"isEnableNoAttack":false,"isVoteVisible":false,"isTalkOnFirstDay":true,"responseTimeout":120000,"actionTimeout":60000,"maxRevote":1,"maxAttackRevote":1,"roleNumMap":{"BODYGUARD":0,"MEDIUM":0,"POSSESSED":1,"SEER":1,"VILLAGER":2,"WEREWOLF":1}}}"""
packet = Packet.from_dict(json.loads(value))

print(packet.request) # Request.INITIALIZE
print(packet.info.agent) # Agent[01]

詳細については下記のプロトコルの説明やゲームサーバのソースコードを参考にしてください。
プロトコルの実装について

インストール方法

python -m pip install aiwolf-nlp-common

運営向け

パッケージ管理ツールとしてuvの使用を推奨します。

git clone https://github.com/kano-lab/aiwolf-nlp-common.git
cd aiwolf-nlp-common
uv venv
uv sync

パッケージのビルド

uv build

パッケージの配布

PyPI

uv publish --token <PyPIのアクセストークン>

TestPyPI

uv publish --publish-url https://test.pypi.org/legacy/ --token <TestPyPIのアクセストークン>

uvを使用しない場合については、パッケージ化と配布については下記のページを参考にしてください。
Packaging and distributing projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiwolf_nlp_common-0.5.0.tar.gz (40.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiwolf_nlp_common-0.5.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file aiwolf_nlp_common-0.5.0.tar.gz.

File metadata

  • Download URL: aiwolf_nlp_common-0.5.0.tar.gz
  • Upload date:
  • Size: 40.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.5

File hashes

Hashes for aiwolf_nlp_common-0.5.0.tar.gz
Algorithm Hash digest
SHA256 de052ea281bea112f8feeca17180d7711f9da23793263d02fc5bd3be56364b44
MD5 ef4dd1cfd14f4a135ff432dc1483b61d
BLAKE2b-256 69d1f96c5c288195f003cbce06dbbe5cdc1559c96e2e37c9ccd9e3e5531fd5dc

See more details on using hashes here.

File details

Details for the file aiwolf_nlp_common-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aiwolf_nlp_common-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54d413ad2b1018515fa2fce5f64e5ca3b47ee976602bd0010cf11e302aaf7c29
MD5 da0d20af15d6b64c56c7c3588a8b8270
BLAKE2b-256 ec2530e4af9042ac737b7223b7a131cfe606188a74555383c67b4439ae19fc09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page