Save
This commit is contained in:
parent
f328f21a19
commit
aa2e28e247
3 changed files with 44 additions and 29 deletions
|
|
@ -65,12 +65,14 @@ PBAR = None
|
||||||
FILENAME = None
|
FILENAME = None
|
||||||
|
|
||||||
# Dialogue / Choices
|
# Dialogue / Choices
|
||||||
CODE101 = True
|
CODE101 = False
|
||||||
CODE102 = True
|
CODE102 = False
|
||||||
|
|
||||||
|
# Picture
|
||||||
|
CODE150 = False
|
||||||
|
|
||||||
# Set String (Fragile but necessary)
|
# Set String (Fragile but necessary)
|
||||||
CODE122 = False
|
CODE122 = True
|
||||||
CODE150 = False
|
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
CODE210 = False
|
CODE210 = False
|
||||||
|
|
@ -79,8 +81,8 @@ CODE250 = False
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
SCENARIOFLAG = False
|
SCENARIOFLAG = False
|
||||||
OPTIONSFLAG = False
|
OPTIONSFLAG = True
|
||||||
NPCFLAG = False
|
NPCFLAG = True
|
||||||
DBNAMEFLAG = False
|
DBNAMEFLAG = False
|
||||||
DBVALUEFLAG = False
|
DBVALUEFLAG = False
|
||||||
ITEMFLAG = False
|
ITEMFLAG = False
|
||||||
|
|
@ -301,8 +303,8 @@ def searchCodes(events, pbar, jobList, filename):
|
||||||
while i < len(codeList):
|
while i < len(codeList):
|
||||||
### Event Code: 101 Message
|
### Event Code: 101 Message
|
||||||
if codeList[i]["code"] == 101 and CODE101 == True:
|
if codeList[i]["code"] == 101 and CODE101 == True:
|
||||||
speakerRegex = r"@\d+\r?\n(.*):?\r?\n" # Default: r"@\d+\r?\n(.*):\r?\n"
|
speakerRegex = r"@\d+\r?\n(.*?):?\r?\n" # Default: r"@\d+\r?\n(.*):?\r?\n""
|
||||||
textRegex = r"@?\d*\r?\n?\u3000*([\w\W]+)\r?\n?" # Default: r"@?\d*\r?\n?\u3000*([\w\W]+)\r?\n?"
|
textRegex = r"@\d+\r?\n.*?:?\r?\n(.*)" # Default: r"@\d+\r?\n.*:?\r?\n(.*)"
|
||||||
|
|
||||||
# Grab String
|
# Grab String
|
||||||
jaString = codeList[i]["stringArgs"][0]
|
jaString = codeList[i]["stringArgs"][0]
|
||||||
|
|
@ -318,12 +320,11 @@ def searchCodes(events, pbar, jobList, filename):
|
||||||
totalTokens[0] += response[1][0]
|
totalTokens[0] += response[1][0]
|
||||||
totalTokens[1] += response[1][1]
|
totalTokens[1] += response[1][1]
|
||||||
|
|
||||||
# Set nametag and remove from string
|
# Set Name
|
||||||
codeList[i]["stringArgs"][0] = codeList[i]["stringArgs"][0].replace(match.group(1), speaker)
|
codeList[i]["stringArgs"][0] = codeList[i]["stringArgs"][0].replace(match.group(1), speaker)
|
||||||
jaString = jaString.replace(match.group(1), "")
|
|
||||||
|
|
||||||
# Grab Only Text
|
# Grab Only Text
|
||||||
match = re.search(textRegex, jaString)
|
match = re.search(textRegex, jaString, flags=re.DOTALL)
|
||||||
if match:
|
if match:
|
||||||
jaString = match.group(1)
|
jaString = match.group(1)
|
||||||
initialJAString = jaString
|
initialJAString = jaString
|
||||||
|
|
@ -512,11 +513,7 @@ def searchCodes(events, pbar, jobList, filename):
|
||||||
if "stringArgs" in codeList[i] and len(codeList[i]["stringArgs"]) > 0:
|
if "stringArgs" in codeList[i] and len(codeList[i]["stringArgs"]) > 0:
|
||||||
font150 = "\\f[8]"
|
font150 = "\\f[8]"
|
||||||
# Grab String
|
# Grab String
|
||||||
jaString = re.search(r"^\n?(.*)\n?$", codeList[i]["stringArgs"][0])
|
jaString = codeList[i]["stringArgs"][0]
|
||||||
if jaString:
|
|
||||||
jaString = jaString.group(1)
|
|
||||||
else:
|
|
||||||
jaString = codeList[i]["stringArgs"][0]
|
|
||||||
|
|
||||||
# Japanses Text Only
|
# Japanses Text Only
|
||||||
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa-zA-Z0-9]+", jaString):
|
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa-zA-Z0-9]+", jaString):
|
||||||
|
|
@ -533,7 +530,6 @@ def searchCodes(events, pbar, jobList, filename):
|
||||||
and jaString != ""
|
and jaString != ""
|
||||||
and "_" not in jaString
|
and "_" not in jaString
|
||||||
and '",' not in jaString
|
and '",' not in jaString
|
||||||
and "/" not in jaString
|
|
||||||
and ">" not in jaString
|
and ">" not in jaString
|
||||||
and "<" not in jaString
|
and "<" not in jaString
|
||||||
):
|
):
|
||||||
|
|
@ -948,7 +944,7 @@ def searchDB(events, pbar, jobList, filename):
|
||||||
# Write Name
|
# Write Name
|
||||||
file.write(f"{dataList[j].get('value')} ({npcList[0][0]})\n")
|
file.write(f"{dataList[j].get('value')} ({npcList[0][0]})\n")
|
||||||
|
|
||||||
# Set
|
# Set Data
|
||||||
dataList[j].update({"value": npcList[0][0]})
|
dataList[j].update({"value": npcList[0][0]})
|
||||||
npcList[0].pop(0)
|
npcList[0].pop(0)
|
||||||
|
|
||||||
|
|
@ -976,7 +972,6 @@ def searchDB(events, pbar, jobList, filename):
|
||||||
# Set Data
|
# Set Data
|
||||||
dataList[j].update({"value": translatedText})
|
dataList[j].update({"value": translatedText})
|
||||||
npcList[1].pop(0)
|
npcList[1].pop(0)
|
||||||
file.write(f"\n{translatedText}")
|
|
||||||
|
|
||||||
# Grab Scenario
|
# Grab Scenario
|
||||||
if "サブキャラ会話" in table["name"] and SCENARIOFLAG == True:
|
if "サブキャラ会話" in table["name"] and SCENARIOFLAG == True:
|
||||||
|
|
@ -1162,7 +1157,7 @@ def searchDB(events, pbar, jobList, filename):
|
||||||
dataList[j].update({"value": dataList[j].get("value").replace(ogString, translatedText)})
|
dataList[j].update({"value": dataList[j].get("value").replace(ogString, translatedText)})
|
||||||
|
|
||||||
# Grab Options
|
# Grab Options
|
||||||
if table["name"] == "サブEv" and OPTIONSFLAG == True:
|
if table["name"] == "用語設定" and OPTIONSFLAG == True:
|
||||||
for option in table["data"]:
|
for option in table["data"]:
|
||||||
dataList = option["data"]
|
dataList = option["data"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,13 @@ def getPricingConfig(model):
|
||||||
"batchSize": 10,
|
"batchSize": 10,
|
||||||
"frequencyPenalty": 0.2
|
"frequencyPenalty": 0.2
|
||||||
}
|
}
|
||||||
|
elif "gpt-4.1" in model:
|
||||||
|
return {
|
||||||
|
"inputAPICost": 2.00,
|
||||||
|
"outputAPICost": 8.00,
|
||||||
|
"batchSize": 30,
|
||||||
|
"frequencyPenalty": 0.05
|
||||||
|
}
|
||||||
elif "gpt-5" in model:
|
elif "gpt-5" in model:
|
||||||
return {
|
return {
|
||||||
"inputAPICost": 1.25,
|
"inputAPICost": 1.25,
|
||||||
|
|
@ -261,11 +268,23 @@ def translateText(system, user, history, penalty, formatType, model):
|
||||||
|
|
||||||
# Content to TL
|
# Content to TL
|
||||||
msg.append({"role": "user", "content": f"```\n{user}\n```"})
|
msg.append({"role": "user", "content": f"```\n{user}\n```"})
|
||||||
response = openai.chat.completions.create(
|
|
||||||
model=model,
|
# Call OpenAI API
|
||||||
response_format=responseFormat,
|
if "gpt-5" in model:
|
||||||
messages=msg,
|
response = openai.chat.completions.create(
|
||||||
)
|
model=model,
|
||||||
|
response_format=responseFormat,
|
||||||
|
messages=msg,
|
||||||
|
reasoning_effort="minimal"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
response = openai.chat.completions.create(
|
||||||
|
model=model,
|
||||||
|
response_format=responseFormat,
|
||||||
|
messages=msg,
|
||||||
|
temperature=0,
|
||||||
|
frequency_penalty=penalty
|
||||||
|
)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@ Here are some vocabulary and terms so that you know the proper spelling and tran
|
||||||
|
|
||||||
# Game Characters
|
# Game Characters
|
||||||
かけだし錬金術師 (Novice Alchemist)
|
かけだし錬金術師 (Novice Alchemist)
|
||||||
アル=ソレイユ (Al Soleil) - Female
|
アル=ソレイユ (Al Soleil) - Female
|
||||||
|
|
||||||
月夜の錬金術師 (Moonlit Alchemist)
|
月夜の錬金術師 (Moonlit Alchemist)
|
||||||
ケミィ=ルーン (Chemmy Rune) - Female
|
ケミィ=ルーン (Chemmy Rune) - Female
|
||||||
|
|
||||||
英雄の娘 (Hero's Daughter)
|
英雄の娘 (Hero's Daughter)
|
||||||
ルビナ=ローズストーン (Rubina Rosestone) - Female
|
ルビナ=ローズストーン (Rubina Rosestone) - Female
|
||||||
|
|
||||||
鋼鉄の意志 (Iron Will)
|
鋼鉄の意志 (Iron Will)
|
||||||
スティーリア=ブリュンヒルデ (Stilia Brynhildr) - Female
|
スティーリア=ブリュンヒルデ (Stilia Brynhildr) - Female
|
||||||
|
|
||||||
# Lewd Terms
|
# Lewd Terms
|
||||||
マンコ (pussy)
|
マンコ (pussy)
|
||||||
|
|
@ -73,6 +73,7 @@ Here are some vocabulary and terms so that you know the proper spelling and tran
|
||||||
お姉ちゃん (onee-chan)
|
お姉ちゃん (onee-chan)
|
||||||
ねえさん (nee-san)
|
ねえさん (nee-san)
|
||||||
おじさん (old man)
|
おじさん (old man)
|
||||||
|
ルビナ=ローズストーン (Rubina Rosestone)
|
||||||
|
|
||||||
# Terms
|
# Terms
|
||||||
初めから (Start)
|
初めから (Start)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue