Metadata-Version: 2.3
Name: aiwolf_nlp_common
Version: 0.2.0
Summary: aiwolf-nlp-common
Project-URL: Homepage, https://aiwolf.org
Author-email: aiwolfdial <aiwolf@kanolab.net>, nwatanabe <aiwolf@kanolab.net>
Maintainer-email: aiwolfdial <aiwolf@kanolab.net>, nwatanabe <aiwolf@kanolab.net>
License: MIT License
        
        Copyright (c) 2024 Kano Laboratory
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Keywords: aiwolf,aiwolfNLP,aiwolfdial
Requires-Python: >=3.8
Requires-Dist: bcrypt>=3.2
Requires-Dist: cffi>=1.4.1
Requires-Dist: cryptography>=3.3
Requires-Dist: paramiko>=3.5
Requires-Dist: pycparser>=2.22
Requires-Dist: pynacl>=1.5
Requires-Dist: requests
Requires-Dist: websocket-client>=1.8.0
Description-Content-Type: text/markdown

# aiwolf-nlp-common

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

ゲームサーバから送信されたJSON形式の文字列から、以下のオブジェクトを生成します。

```python
from aiwolf_nlp_common.protocol import CommunicationProtocol

recv:str = """{"request":"INITIALIZE","info":{"statusMap":{"Agent[01]":"ALIVE","Agent[02]":"ALIVE","Agent[03]":"ALIVE","Agent[04]":"ALIVE","Agent[05]":"ALIVE"},"roleMap":{"Agent[02]":"SEER"},"remainTalkMap":{},"remainWhisperMap":{},"day":0,"agent":"Agent[02]"},"setting":{"roleNumMap":{"BODYGUARD":0,"MEDIUM":0,"POSSESSED":0,"SEER":1,"VILLAGER":3,"WEREWOLF":1},"maxTalk":3,"maxTalkTurn":15,"maxWhisper":3,"maxWhisperTurn":15,"maxSkip":3,"isEnableNoAttack":true,"isVoteVisible":false,"isTalkOnFirstDay":true,"responseTimeout":90000,"actionTimeout":60000,"maxRevote":1,"maxAttackRevote":1}}"""
protocol = CommunicationProtocol.initialize_from_json(received_str=recv)

print(protocol.request)
print(protocol.info.agent)
```

```
INITIALIZE
Agent[02]
```

詳細については下記のプロトコルの説明やゲームサーバのソースコードを参考にしてください。  
[プロトコルの実装について](https://github.com/kano-lab/aiwolf-nlp-server/blob/main/doc/protocol.md)

## インストール方法

```
pip install aiwolf-nlp-common
```

> [!WARNING]
> `pip install aiwolf-nlp-common` に失敗する場合は、以下の手順を試してください。

```
pip install --upgrade pip
pip install --upgrade setuptools
pip install -i https://test.pypi.org/simple/ aiwolf-nlp-common
```