コミットを比較
184 コミット
62fb5dee34
...
main
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
| 0e1e87ec05 | |||
| 7edc6e6a80 | |||
| cf7eed84bc | |||
| 05052bbccd | |||
| 49d887b6cd | |||
| 9e28c1744e | |||
| 3eab48c8ef | |||
| 8994105d4e | |||
| bdf13bf97f | |||
| 11c2f0c0d4 | |||
| b3ae86033c | |||
| 88e710572a | |||
| 9a68a29e1b | |||
| 270b4515d8 | |||
| 9d0b5aff70 | |||
| 41f5a7718f | |||
| 4ad5868b63 | |||
| 37c9947d4a | |||
| 6ee5582a32 | |||
| 12fbdbc7e2 | |||
| a9ba0f697e | |||
| 93fc438d8a | |||
| 50281f9120 | |||
| c6028507ea | |||
| 9149483dcb | |||
| a7785fa2c1 | |||
| 49661dad71 | |||
| fb5b64b49b | |||
| e49eff0876 | |||
| af862a7981 | |||
| 29b831e380 | |||
| 98703409ef | |||
| 7289fe5812 | |||
| ba5a428f7b | |||
| 05cd19525c | |||
| 80dc32dbb7 | |||
| 75f3f1cff3 | |||
| 2ba68d9e31 | |||
| 65fe453426 | |||
| 2ce5329aae | |||
| 20cf2cec04 | |||
| 8c53efe707 | |||
| f13c6d8260 | |||
| d66153b87a | |||
| 3f0825f835 | |||
| c83c99bc74 | |||
| 9f705446a8 | |||
| 11195e5125 | |||
| 57ae0992c1 | |||
| a4ec55a4cd | |||
| 5583ded358 | |||
| 719ae99273 | |||
| dbfd6deb1e | |||
| 299a3acdff | |||
| d98714018c | |||
| 081ab9aa2e | |||
| f0570e0caf | |||
| dfa09e1e66 | |||
| 28f16ec1d6 | |||
| 97393d51e2 | |||
| ce11a0244c | |||
| 7e928120a4 | |||
| 3874f838f1 | |||
| f2683bca27 | |||
| 7b7dbdabb2 | |||
| 7277819b6e | |||
| 0b8e9812b9 | |||
| a00eaf7ff2 | |||
| 80d6c09967 | |||
| 37618c5df1 | |||
| d80d03db46 | |||
| fa6b5ba68b | |||
| cff0ec27d8 | |||
| d676372276 | |||
| 39cf64149f | |||
| 436f21244d | |||
| f6e7a7d42f | |||
| 420c8f1bfe | |||
| 7517fa251b | |||
| 9d72533e17 | |||
| 13a7f0d26d | |||
| 6cc400dbe6 | |||
| 51a52c9ba8 | |||
| 688b781faa | |||
| d67faabeff | |||
| a09278cfb7 | |||
| dfe5219342 | |||
| 5c1e615ab7 | |||
| 97ccb886b9 | |||
| 9fa218badf | |||
| 0bda9547b1 | |||
| 1f23e02fad | |||
| 4bbc5975a7 | |||
| 322243db23 | |||
| 5aad85c9f6 | |||
| e705e059e2 | |||
| 89a34a7cdf | |||
| d7ecb02f50 | |||
| 6196d5f2ed | |||
| daaac744e3 | |||
| 5fe3be91af | |||
| 9330b68e1f | |||
| 658d2fd9b3 | |||
| 41194d580f | |||
| f02132bbf1 | |||
| d10393e3b7 | |||
| 171c4ce909 | |||
| 2d28738010 | |||
| eee780aa90 | |||
| ba12ce6388 | |||
| 63ab75097e | |||
| 2d4f4bf6ee | |||
| 9dceca6d99 | |||
| 649055d6d6 | |||
| 1b1fcd44e6 | |||
| 6524158f42 | |||
| 68d35c6a56 | |||
| 2aca654548 | |||
| e280b339f2 | |||
| 303e71ab5b | |||
| f5ca15e335 | |||
| 47c7ee44cf | |||
| 8a6eb3e229 | |||
| 4031ab28bd | |||
| 6724a01c1e | |||
| 8a4294395a | |||
| 99a31b5660 | |||
| b4cf19af99 | |||
| 64fae25eae | |||
| 699d907f35 | |||
| d9a41713c8 | |||
| 098fdeca1d | |||
| 1a2883b831 | |||
| 25bbbfc9b8 | |||
| ea2d86e9a7 | |||
| cbc5f39bff | |||
| 861ed086c0 | |||
| 5019e12aee | |||
| 1a23ad790f | |||
| 35255b057f | |||
| 4f71f3410c | |||
| 8a0abdb7fa | |||
| 51bfc8a8d2 | |||
| d34d6e90fb | |||
| 37b73e9927 | |||
| f95fb6e4a5 | |||
| f48861909a | |||
| 69c5fef3ae | |||
| d67e490f84 | |||
| b9b53d3fef | |||
| ec5b7a7627 | |||
| d946534401 | |||
| bbfb8c97fe | |||
| 64f37cf346 | |||
| 7659245724 | |||
| 9aaf949d15 | |||
| ae0d754992 | |||
| 1d30353326 | |||
| d464a9b5b7 | |||
| 844bc64927 | |||
| 4d38bc1926 | |||
| b49d618f5b | |||
| 539aa41940 | |||
| 5453ccbdbe | |||
| d46cb4e58f | |||
| 94f2e5dab3 | |||
| 86761e4451 | |||
| b40f5de276 | |||
| 52c862f56b | |||
| da59975cba | |||
| 6cbd1fcb4d | |||
| e9f3642698 | |||
| eb38bcf5de | |||
| 28aae0158f | |||
| 9c2428c590 | |||
| 666d9ca764 | |||
| 543b3bbdd3 | |||
| 594766db98 | |||
| 203958b150 | |||
| 8ecb92691e | |||
| ff392ea999 | |||
| 3a5b63742b | |||
| d78ad10c78 | |||
| b8fed71beb |
@@ -1,3 +1,5 @@
|
|||||||
/connection.py
|
/connection.py
|
||||||
/__pycache__
|
__pycache__
|
||||||
|
/nizika_talking.wav
|
||||||
|
/youtube.py
|
||||||
|
/log.txt
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "nizika_ai"]
|
||||||
|
path = nizika_ai
|
||||||
|
url = https://git.miteruzo.com/miteruzo/nizika_ai
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
言語処理ライブラリ(AqKanji2Koe)は、BSDライセンスに基づいてライセンスされている
|
||||||
|
下記のソフトウェアを使用しています。
|
||||||
|
This software has been used open source below.
|
||||||
|
|
||||||
|
--- MARISA: Matching Algorithm with Recursively Implemented StorAge ----
|
||||||
|
Copyright (c) 2010-2012, Susumu Yata
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
- Neither the name of the <ORGANIZATION> nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
--------------------- NAIST Japanese Dictionary ------------------
|
||||||
|
Copyright (c) 2009, Nara Institute of Science and Technology, Japan.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
Neither the name of the Nara Institute of Science and Technology
|
||||||
|
(NAIST) nor the names of its contributors may be used to endorse or
|
||||||
|
promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import subprocess
|
||||||
|
from ctypes import ARRAY # type: ignore
|
||||||
|
from ctypes import POINTER, byref, c_int, c_ubyte, cast, cdll
|
||||||
|
|
||||||
|
|
||||||
|
class Aques:
|
||||||
|
@classmethod
|
||||||
|
def main (cls, text: str, goatoh_mode: bool = False) -> bytearray | None:
|
||||||
|
return cls.__synthe_utf8 (text, 100, './phont/ar_m5.phont' if goatoh_mode else './phont/ar_mf2.phont')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def __synthe_utf8 (text, speed, phont_file = None) -> bytearray | None:
|
||||||
|
if phont_file is None:
|
||||||
|
phont = None
|
||||||
|
else:
|
||||||
|
with open (phont_file, 'rb') as f:
|
||||||
|
phont = f.read ()
|
||||||
|
|
||||||
|
p = subprocess.Popen ('./aques', stdin = subprocess.PIPE,
|
||||||
|
stdout = subprocess.PIPE)
|
||||||
|
koe: str = p.communicate (text.encode ())[0].decode ()
|
||||||
|
|
||||||
|
aqtk = cdll.LoadLibrary ('libAquesTalk2Eva.so')
|
||||||
|
aqtk.AquesTalk2_Synthe_Utf8.restype = POINTER (ARRAY (c_ubyte, 0))
|
||||||
|
size = c_int (0)
|
||||||
|
wav_p = aqtk.AquesTalk2_Synthe_Utf8 (koe.encode ('utf-8'), speed,
|
||||||
|
byref (size), phont)
|
||||||
|
|
||||||
|
if not bool (wav_p):
|
||||||
|
return None
|
||||||
|
|
||||||
|
wav_p = cast (wav_p, POINTER (ARRAY (c_ubyte, size.value)))
|
||||||
|
wav = bytearray (wav_p.contents)
|
||||||
|
aqtk.AquesTalk2_FreeWave (wav_p)
|
||||||
|
|
||||||
|
return wav
|
||||||
|
|
||||||
|
変更前 幅: | 高さ: | サイズ: 17 KiB 変更後 幅: | 高さ: | サイズ: 17 KiB |
|
変更後 幅: | 高さ: | サイズ: 57 KiB |
|
変更後 幅: | 高さ: | サイズ: 99 KiB |
|
変更後 幅: | 高さ: | サイズ: 53 KiB |
|
変更後 幅: | 高さ: | サイズ: 40 KiB |
|
変更後 幅: | 高さ: | サイズ: 166 KiB |
|
変更後 幅: | 高さ: | サイズ: 641 KiB |
|
変更後 幅: | 高さ: | サイズ: 554 KiB |
@@ -0,0 +1,44 @@
|
|||||||
|
import unicodedata
|
||||||
|
|
||||||
|
|
||||||
|
class CommonModule:
|
||||||
|
@staticmethod
|
||||||
|
def is_wide (
|
||||||
|
c: str) \
|
||||||
|
-> bool:
|
||||||
|
return unicodedata.east_asian_width (c) in ['F', 'W', 'A']
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def len_by_full (
|
||||||
|
cls,
|
||||||
|
string: str) \
|
||||||
|
-> float:
|
||||||
|
return sum (1 if cls.is_wide (c) else .5 for c in string)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def index_by_f2c (
|
||||||
|
cls,
|
||||||
|
string: str,
|
||||||
|
index: float) \
|
||||||
|
-> int:
|
||||||
|
i: int = 0
|
||||||
|
work: str = ''
|
||||||
|
for c in string:
|
||||||
|
work += c
|
||||||
|
if cls.len_by_full (work) > index:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
return i
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def mid_by_full (
|
||||||
|
cls,
|
||||||
|
string: str,
|
||||||
|
start: float,
|
||||||
|
length: float) \
|
||||||
|
-> str:
|
||||||
|
trimmed_left: str = string[cls.index_by_f2c (string, start):]
|
||||||
|
|
||||||
|
return trimmed_left[:cls.index_by_f2c (trimmed_left, length)]
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# 各変数に適切な値を設定し,ファイル名を connection.py として保存すること
|
|
||||||
|
|
||||||
OPENAI_ORGANISATION: str = 'org-XXXXXXXXXXXXXXXXXXXXXXXX' \
|
|
||||||
# Organisation ID
|
|
||||||
OPENAI_API_KEY: str = 'sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
|
|
||||||
# API Key
|
|
||||||
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import pygame
|
||||||
|
from pygame.locals import *
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
class Othello:
|
||||||
|
SCREEN_SIZE: tuple = (640, 480)
|
||||||
|
|
||||||
|
BOARD_COLOUR: tuple = (0, 128, 0)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def main (cls) -> None:
|
||||||
|
pygame.init ()
|
||||||
|
screen: pygame.Surface = pygame.display.set_mode (cls.SCREEN_SIZE)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
screen.fill ((0, 0, 0))
|
||||||
|
|
||||||
|
# pygame.draw.rect (screen, BOARD_COLOUR, )
|
||||||
|
|
||||||
|
pygame.display.update ()
|
||||||
|
pygame.time.wait (33)
|
||||||
|
|
||||||
|
for event in pygame.event.get ():
|
||||||
|
if event.type == QUIT:
|
||||||
|
pygame.quit ()
|
||||||
|
sys.exit ()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
Othello.main ()
|
||||||
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
import sys
|
|
||||||
import openai
|
|
||||||
from openai.types import *
|
|
||||||
|
|
||||||
from connection import *
|
|
||||||
|
|
||||||
|
|
||||||
class Talk:
|
|
||||||
max_tokens_count: int = 100
|
|
||||||
responses_count: int = 1
|
|
||||||
temperature: float = .7
|
|
||||||
top_p: int = 1
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def main (cls, message: str) -> str:
|
|
||||||
openai.organization = OPENAI_ORGANISATION
|
|
||||||
openai.api_key = OPENAI_API_KEY
|
|
||||||
|
|
||||||
return cls.__get_message (message).content
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __get_message (cls, message: str) \
|
|
||||||
-> chat.chat_completion_message.ChatCompletionMessage:
|
|
||||||
return openai.chat.completions.create (
|
|
||||||
model = 'gpt-3.5-turbo',
|
|
||||||
messages = [{'role': 'system',
|
|
||||||
'content': 'あなたの名前は伊地知ニジカ。友達はゴートうひとりとラマ田リョウ。好きな人は喜多ちゃん。すべての語尾に「ぬ゛ん」か「だぬ゛ん」をつけて質問に短く答えろ。定期的に「ぬ゛ぅ゛ぅ゛ぅ゛ぅ゛ん゛」、「ボッチチャーン」、「あっ」のいずれかを発しろ'},
|
|
||||||
{'role': 'user',
|
|
||||||
'content': message}]).choices[0].message
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
print (Talk.main (sys.argv[1] if len (sys.argv) > 1 else ''))
|
|
||||||
|
|
||||||