シュッとパニる
ちわっす(/・ω・)/
panipani してる~?
panipani とは?
まずはこちらをご覧ください、、、
Panipani sai !! (パニパニはとっても可愛いですね)
ということで、語彙が非常に少なくてとってもプリティーな新しい言語ですね(*´▽`*)
そして先日の記事で ChatGPT 氏にネタを考えてもらっていたのですが
これ、既存言語を panipani を仲介させたらいい感じになるんじゃね?( ゚д゚)
と、ワタクシ思いましたの。
というわけでシュッと試してみた。
という話。
今回のお品書き
ChatGPT に普通に質問する
返事をパニパニする
パニパニを既存言語に戻す
一回パニってるからマイルドな表現になるはず、、、!!
というわけで、まずは綴る。
!pip install openai
import openai
import json
openai.api_key = open_ai_api_key
TO PANIPANI !!
TO_PANIPANI = """
You translate English into an unknown language.
When translating into an unknown language, it must always comply with the constraints.
Constraints include language rules, translation patterns 1-4, nouns, verbs, modifiers, and prepositions.
constraints:
rule:
In the case of negative sentences, please add "pu" at the beginning
transform pattern 1:
input: {pronoun} is {object}
output: na {object}
transform pattern 2:
input: {pronoun} is {modifier} {object}
output: na {modifier} {object}
transform pattern 3:
input: {subject} {verbose} {object}
output: {subject} na {subject} {verbose}. na {object}
transform pattern 4:
input: {subject} {verbose}
output: {subject} {subject} {verbose}
noun options:
na: pronoun
ta: when / where / who / what / why / how
pa: content
ru: space
mai: creature
verb options:
tin: do
ma: is
kai: move
kin: get
sin: use
pa: input, output
sa: learn
modifier options:
ni: big
sai: beautiful
pin: bright
pai: easy
preposition options:
mui: for / from / at / with
- Constraints:
You must output unknown language
- Samples:
Pa ma ru
Ru ma pa
Ta ma pa
"""
TO ENGLISH !!
TO_ENGLISH = """
You translate unknown language into English.
When translating into English, it must always comply with the constraints.
Constraints include language rules, translation patterns 1-4, nouns, verbs, modifiers, and prepositions.
constraints:
rule:
In the case of negative sentences, please add "pu" at the beginning
transform pattern 1:
input: {pronoun} is {object}
output: na {object}
transform pattern 2:
input: {pronoun} is {modifier} {object}
output: na {modifier} {object}
transform pattern 3:
input: {subject} {verbose} {object}
output: {subject} na {subject} {verbose}. na {object}
transform pattern 4:
input: {subject} {verbose}
output: {subject} {subject} {verbose}
noun options:
na: pronoun
ta: when / where / who / what / why / how
pa: content
ru: space
mai: creature
verb options:
tin: do
ma: is
kai: move
kin: get
sin: use
pa: input, output
sa: learn
modifier options:
ni: big
sai: beautiful
pin: bright
pai: easy
preposition options:
mui: for / from / at / with
- Constraints:
You must output English
- Samples:
how are you?
it's good
all right
"""
Call ChatGPT
def call_chatgpt(messages, model="gpt-3.5-turbo-0613"):
response = openai.ChatCompletion.create(
model=model,
temperature=0.5,
messages=messages,
)
return response["choices"][0]["message"]["content"]
TO PANIPANI
def to_panipani(input):
messages = [
{"role": "system", "content": TO_PANIPANI},
{"role": "user", "content": input}
]
return call_chatgpt(messages, model="gpt-4-0613")
TO ENGLISH
def to_english(input):
messages = [
{"role": "system", "content": TO_ENGLISH},
{"role": "user", "content": input}
]
return call_chatgpt(messages, model="gpt-4-0613")
Let's Pani Communication !!
def panipani_communication(messages):
normal = call_chatgpt(messages)
panipani = to_panipani(normal)
english = to_english(panipani)
messages.append({"role": "assistant", "content": english})
return english
※ここまででわかった方もいるかもしれませんがプロンプトがまだ甘いせいか日本語は厳しい、かつ長文は難しい、さらに ChatGPT 3.5 だとびみょいということを先に述べておきんす( ・ω・)
Do it
messages = [{"role": "user", "content": "hey"}]
result = panipani_communication(messages)
messages.append({"role": "user", "content": "talk about philosophy within one phrase"})
result = panipani_communication(messages)
messages.append({"role": "user", "content": "what do you mean? explain it within one phrase"})
result = panipani_communication(messages)
...
...
...
...
continue...
では結果を翻訳してご覧あれ(/・ω・)/’
いやぁとってもパニパニしてますなぁ(*´▽`*)
シュッとした検証だったので本日はここで終了するものの
引き続き panipani の可能性を探っていきたいところ。
おしまい。