Commit Current
This commit is contained in:
parent
b0f917b701
commit
2b82edc7b4
4 changed files with 209 additions and 76 deletions
|
|
@ -51,8 +51,8 @@ LEAVE = False
|
|||
|
||||
# Flags
|
||||
SPEAKERS = True
|
||||
CHOICES = False
|
||||
DIALOGUE = False
|
||||
CHOICES = True
|
||||
DIALOGUE = True
|
||||
|
||||
# Pricing - Depends on the model https://openai.com/pricing
|
||||
# Batch Size - GPT 3.5 Struggles past 15 lines per request. GPT4 struggles past 50 lines per request
|
||||
|
|
@ -97,7 +97,7 @@ def handleKirikiri(filename, estimate):
|
|||
else:
|
||||
try:
|
||||
with open(
|
||||
"translated/" + filename, "w", encoding="utf-16-le", errors="ignore"
|
||||
"translated/" + filename, "w", encoding="cp932", errors="ignore"
|
||||
) as outFile:
|
||||
start = time.time()
|
||||
translatedData = openFiles(filename)
|
||||
|
|
@ -167,7 +167,7 @@ def getResultString(translatedData, translationTime, filename):
|
|||
|
||||
|
||||
def openFiles(filename):
|
||||
with open("files/" + filename, "r", encoding="utf-16-le") as readFile:
|
||||
with open("files/" + filename, "r", encoding="cp932") as readFile:
|
||||
translatedData = parseKiriKiri(readFile, filename)
|
||||
return translatedData
|
||||
|
||||
|
|
@ -209,8 +209,8 @@ def translateKiriKiri(data, pbar, filename, jobList):
|
|||
i = 0
|
||||
|
||||
# Regex
|
||||
speakerRegex = r'.*elm.name0\s:\s"(.*?)"'
|
||||
dialogueRegex = r"^\s*.*fukidashi.*text.*=.*[\"'](.*?)[\"']"
|
||||
speakerRegex = r'【(.*)】\[CR\]'
|
||||
dialogueRegex = r"^\[text\](.*).*\[KeyWait\]|\[\w+\](.*)\[\/\w+\].*\[KeyWait\]"
|
||||
furiganaRegex = r'(\[eruby\sstr="(.*?)"\stext.*?\])'
|
||||
choicesRegex = r"^\s*\[button\d\sclickse=sys_decide.*text='(.*?)'.*"
|
||||
|
||||
|
|
|
|||
|
|
@ -60,27 +60,27 @@ THREADS = int(os.getenv("fileThreads"))
|
|||
|
||||
# [Display name, file extension, handle function]
|
||||
MODULES = [
|
||||
["RPGMaker MV/MZ", "json", handleMVMZ],
|
||||
["RPGMaker Plugins", "js", handlePlugin],
|
||||
["RPGMaker ACE", "yaml", handleACE],
|
||||
["CSV (From Translator++)", "csv", handleCSV],
|
||||
["Eushully", "txt", handleEushully],
|
||||
["Alice", "txt", handleAlice],
|
||||
["Tyrano", "ks", handleTyrano],
|
||||
["Kirikiri", "tjs", handleKirikiri],
|
||||
["JSON", "json", handleJSON],
|
||||
["Kansen", "ks", handleKansen],
|
||||
["Lune", "json", handleLune],
|
||||
["Atelier", "txt", handleAtelier],
|
||||
["Anim", "json", handleAnim],
|
||||
["NScript", "txt", handleOnscripter],
|
||||
["Wolf", "json", handleWOLF],
|
||||
["Wolf", "txt", handleWOLF2],
|
||||
["Javascript", "js", handleJavascript],
|
||||
["Iris", "txt", handleIris],
|
||||
["Regex", "txt", handleRegex],
|
||||
["Unity", "txt", handleUnity],
|
||||
["Images", "", handleImages],
|
||||
["RPGMaker MV/MZ", ["json"], handleMVMZ],
|
||||
["RPGMaker Plugins", ["js"], handlePlugin],
|
||||
["RPGMaker ACE", ["yaml"], handleACE],
|
||||
["CSV (From Translator++)", ["csv"], handleCSV],
|
||||
["Eushully", ["txt"], handleEushully],
|
||||
["Alice", ["txt"], handleAlice],
|
||||
["Tyrano", ["ks"], handleTyrano],
|
||||
["Kirikiri", ['ks', 'tjs', 'ssd', 'asd'], handleKirikiri],
|
||||
["JSON", ["json"], handleJSON],
|
||||
["Kansen", ["ks"], handleKansen],
|
||||
["Lune", ["json"], handleLune],
|
||||
["Atelier", ["txt"], handleAtelier],
|
||||
["Anim", ["json"], handleAnim],
|
||||
["NScript", ["txt"], handleOnscripter],
|
||||
["Wolf", ["json"], handleWOLF],
|
||||
["Wolf", ["txt"], handleWOLF2],
|
||||
["Javascript", ["js"], handleJavascript],
|
||||
["Iris", ["txt"], handleIris],
|
||||
["Regex", ["txt"], handleRegex],
|
||||
["Unity", ["txt"], handleUnity],
|
||||
["Images", [""], handleImages],
|
||||
]
|
||||
|
||||
# Info Message
|
||||
|
|
@ -133,7 +133,8 @@ files to translate are in the /files folder and that you picked the right game e
|
|||
futures = [
|
||||
executor.submit(MODULES[version][2], filename, estimate)
|
||||
for filename in os.listdir("files")
|
||||
if filename.endswith(MODULES[version][1]) and filename != ".gitkeep"
|
||||
for m in MODULES[version][1]
|
||||
if filename.endswith(m) and filename != ".gitkeep"
|
||||
]
|
||||
for future in as_completed(futures):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ MAXHISTORY = 10
|
|||
ESTIMATE = ""
|
||||
TOKENS = [0, 0]
|
||||
NAMESLIST = []
|
||||
FIRSTLINESPEAKERS = False # If 1st line of dialogue is a speaker, set to True
|
||||
FIRSTLINESPEAKERS = True # If 1st line of dialogue is a speaker, set to True
|
||||
NAMES = False # Output a list of all the character names found
|
||||
BRFLAG = False # If the game uses <br> instead
|
||||
FIXTEXTWRAP = True # Overwrites textwrap
|
||||
|
|
@ -58,7 +58,7 @@ if "gpt-3.5" in MODEL:
|
|||
elif "gpt-4" in MODEL:
|
||||
INPUTAPICOST = 0.0025
|
||||
OUTPUTAPICOST = 0.01
|
||||
BATCHSIZE = 20
|
||||
BATCHSIZE = 30
|
||||
FREQUENCY_PENALTY = 0.1
|
||||
|
||||
# tqdm Globals
|
||||
|
|
@ -68,8 +68,8 @@ LEAVE = False
|
|||
|
||||
# Dialogue / Scroll / Choices (Main Codes)
|
||||
CODE401 = True
|
||||
CODE405 = False
|
||||
CODE102 = False
|
||||
CODE405 = True
|
||||
CODE102 = True
|
||||
|
||||
# Optional
|
||||
CODE101 = False # Turn this one when names exist in 101
|
||||
|
|
@ -826,6 +826,12 @@ def searchNames(data, pbar, context):
|
|||
j += 1
|
||||
continue
|
||||
else:
|
||||
with open(
|
||||
"translations.txt", "a", encoding="utf-8"
|
||||
) as file:
|
||||
file.write(
|
||||
f'{data[j]["name"]} ({translatedNameBatch[0]})\n'
|
||||
)
|
||||
# Get Text
|
||||
data[j]["name"] = translatedNameBatch[0]
|
||||
translatedNameBatch.pop(0)
|
||||
|
|
@ -2565,41 +2571,6 @@ def getSpeaker(speaker):
|
|||
return response
|
||||
return [speaker, [0, 0]]
|
||||
|
||||
|
||||
def subVars(jaString):
|
||||
jaString = jaString.replace("\u3000", " ")
|
||||
|
||||
# Formatting
|
||||
codeList = re.findall(
|
||||
r"([\\]*(\w+)\[(\d+)\])|([\\]*(\w+)\[[\\]*\\w+\[(\d+)\]\])", jaString
|
||||
)
|
||||
codeList = set(codeList)
|
||||
if len(codeList) != 0:
|
||||
for var in codeList:
|
||||
if var[2]:
|
||||
jaString = jaString.replace(var[0], f"[{var[1]}Code_" + f"{var[2]}]")
|
||||
else:
|
||||
jaString = jaString.replace(var[3], f"[{var[4]}Code_" + f"{var[5]}]")
|
||||
|
||||
# Put all lists in list and return
|
||||
return [jaString, codeList]
|
||||
|
||||
|
||||
def resubVars(translatedText, codeList):
|
||||
# Formatting
|
||||
for var in codeList:
|
||||
if var[2]:
|
||||
translatedText = translatedText.replace(
|
||||
f"[{var[1]}Code_" + f"{var[2]}]", var[0]
|
||||
)
|
||||
else:
|
||||
translatedText = translatedText.replace(
|
||||
f"[{var[4]}Code_" + f"{var[5]}]", var[3]
|
||||
)
|
||||
|
||||
return translatedText
|
||||
|
||||
|
||||
def batchList(input_list, batch_size):
|
||||
if not isinstance(batch_size, int) or batch_size <= 0:
|
||||
raise ValueError("batch_size must be a positive integer")
|
||||
|
|
@ -2682,7 +2653,6 @@ def cleanTranslatedText(translatedText, varResponse):
|
|||
|
||||
# Elongate Long Dashes (Since GPT Ignores them...)
|
||||
translatedText = elongateCharacters(translatedText)
|
||||
translatedText = resubVars(translatedText, varResponse[1])
|
||||
return translatedText
|
||||
|
||||
|
||||
|
|
@ -2762,7 +2732,7 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
if isinstance(tItem, list):
|
||||
payload = {f"Line{i+1}": string for i, string in enumerate(tItem)}
|
||||
payload = json.dumps(payload, indent=4, ensure_ascii=False)
|
||||
varResponse = subVars(payload)
|
||||
varResponse = [payload, []]
|
||||
subbedT = varResponse[0]
|
||||
else:
|
||||
varResponse = [tItem, []]
|
||||
|
|
|
|||
176
vocab.txt
176
vocab.txt
|
|
@ -1,11 +1,19 @@
|
|||
Here are some vocabulary and terms so that you know the proper spelling and translation.
|
||||
```
|
||||
# Game Characters
|
||||
御木原菜月 (Mikihara Natsuki) - Female
|
||||
エクセルシフォン (Excel Chiffon) - Female
|
||||
如月深冬 (Kisaragi Mifuyu) - Female
|
||||
エクセルショコラ (Excel Chocolat) - Female
|
||||
レヴィエラ (Reviella) - Female
|
||||
レイア (Leia) - Female
|
||||
アウラ (Aura) - Female
|
||||
ハヤト (Hayato) - Male
|
||||
ルード (Rude) - Male
|
||||
トマ (Toma) - Male
|
||||
ガスト (Gust) - Male
|
||||
マスル (Masuru) - Male
|
||||
準騎士 (Junior Knight) - Male
|
||||
カグヤ (Kaguya) - Unknown
|
||||
クローネ (Krone) - Male
|
||||
レックス (Rex) - Male
|
||||
アイカ (Aika) - Unknown
|
||||
トミー (Tommy) - Male
|
||||
|
||||
# Lewd Terms
|
||||
マンコ (pussy)
|
||||
|
|
@ -50,12 +58,13 @@ ME 音量 (ME Volume)
|
|||
回想する (Recollection)
|
||||
|
||||
# RPG
|
||||
魂 (Soul)
|
||||
エクスポーション (EX Potion)
|
||||
アスカロン (Ascalon)
|
||||
刀 (Sword)
|
||||
ゴブリン (Goblin)
|
||||
|
||||
# Terms
|
||||
# Demons/Angels
|
||||
悪魔 (Devil)
|
||||
上級悪魔 (Arch Devil)
|
||||
歪魔 (Distorted Devil)
|
||||
|
|
@ -75,10 +84,163 @@ ME 音量 (ME Volume)
|
|||
鬼 (Oni)
|
||||
妖怪 (Yokai)
|
||||
式神 (Shikigami)
|
||||
|
||||
# Terms
|
||||
ローバー (Roper)
|
||||
w ((lol))
|
||||
巫女 (Shrine Maiden)
|
||||
コイツ (this bastard)
|
||||
エルゴネア (Ergonia)
|
||||
|
||||
# Locations
|
||||
真エンド (True End)
|
||||
ドリンク&ベーカリー (Drink & Bakery)
|
||||
喫茶クナイ (Cafe Kunai)
|
||||
ミクダース民家 (Mikudas Residence)
|
||||
ブラウン探偵事務所 (Brown Detective Agency)
|
||||
ル王都 (Capital of Ru)
|
||||
2ママワガ別荘 (2 Mama Waga Villa)
|
||||
ルノースオーラ城レイア自室 (Lunorth Aura Castle Leia's Room)
|
||||
エトワール (Etoile)
|
||||
シュード地区 (Shude District)
|
||||
レポロ (Reporo)
|
||||
コル (Kor)
|
||||
ステゴ (Stego)
|
||||
リスカ (Riska)
|
||||
|
||||
#Armors
|
||||
-----鎧系 (-----Armor Types)
|
||||
布の服 (Cloth Clothes)
|
||||
レザーベスト (Leather Vest)
|
||||
冒険者の服 (Adventurer's Clothes)
|
||||
ハードレザー (Hard Leather)
|
||||
ブリガンダイン (Brigandine)
|
||||
クロースアーマー (Cloth Armor)
|
||||
レザーアーマー (Leather Armor)
|
||||
ブロンズブレスト (Bronze Breastplate)
|
||||
アイアンブレスト (Iron Breastplate)
|
||||
ミスリルブレスト (Mithril Breastplate)
|
||||
ドラゴンブレスト (Dragon Breastplate)
|
||||
ブロンズアーマー (Bronze Armor)
|
||||
アイアンアーマー (Iron Armor)
|
||||
ミスリルアーマー (Mithril Armor)
|
||||
ドラゴンアーマー (Dragon Armor)
|
||||
木綿のローブ (Cotton Robe)
|
||||
絹のマント (Silk Mantle)
|
||||
術士のローブ (Sorcerer's Robe)
|
||||
賢者のローブ (Sage's Robe)
|
||||
エレメンタルマント (Elemental Mantle)
|
||||
-----盾系 (-----Shield Types)
|
||||
バックラー (Buckler)
|
||||
ラウンドバックラー (Round Buckler)
|
||||
スパイクバックラー (Spike Buckler)
|
||||
ミスリルバックラー (Mithril Buckler)
|
||||
ドラゴンバックラー (Dragon Buckler)
|
||||
ウッドシールド (Wood Shield)
|
||||
ブロンズシールド (Bronze Shield)
|
||||
アイアンシールド (Iron Shield)
|
||||
ミスリルシールド (Mithril Shield)
|
||||
ドラゴンシールド (Dragon Shield)
|
||||
ウッドバングル (Wood Bangle)
|
||||
ブロンズバングル (Bronze Bangle)
|
||||
アイアンバングル (Iron Bangle)
|
||||
ミスリルバングル (Mithril Bangle)
|
||||
ドラゴンバングル (Dragon Bangle)
|
||||
-----兜系 (-----Helmets)
|
||||
バンダナ (Bandana)
|
||||
レザーバンダナ (Leather Bandana)
|
||||
皮の帽子 (Leather Hat)
|
||||
ターバン (Turban)
|
||||
羽根付き帽子 (Feathered Hat)
|
||||
レザーキャップ (Leather Cap)
|
||||
ウッドキャップ (Wood Cap)
|
||||
ブロンズキャップ (Bronze Cap)
|
||||
アイアンキャップ (Iron Cap)
|
||||
ミスリルキャップ (Mithril Cap)
|
||||
ドラゴンキャップ (Dragon Cap)
|
||||
チェインコイフ (Chain Coif)
|
||||
ブロンズヘルム (Bronze Helm)
|
||||
アイアンヘルム (Iron Helm)
|
||||
ミスリルヘルム (Mithril Helm)
|
||||
ドラゴンヘルム (Dragon Helm)
|
||||
とんがり帽子 (Pointed Hat)
|
||||
サークレット (Circlet)
|
||||
シルバーサークレット (Silver Circlet)
|
||||
ゴールドサークレット (Gold Circlet)
|
||||
ミスリルサークレット (Mithril Circlet)
|
||||
マスターサークレット (Master Circlet)
|
||||
-----装飾品系 (-----Accessories)
|
||||
ガードストーン (Guard Stone)
|
||||
ガードリング (Guard Ring)
|
||||
パワーストーン (Power Stone)
|
||||
パワーリング (Power Ring)
|
||||
スピードストーン (Speed Stone)
|
||||
スピードリング (Speed Ring)
|
||||
ラッキーストーン (Lucky Stone)
|
||||
ラッキーリング (Lucky Ring)
|
||||
マジカルストーン (Magical Stone)
|
||||
マジカルリング (Magical Ring)
|
||||
シューターストーン (Shooter Stone)
|
||||
シューターリング (Shooter Ring)
|
||||
マスターストーン (Master Stone)
|
||||
マスターリング (Master Ring)
|
||||
ポイズンガード (Poison Guard)
|
||||
ポイズンガードS (Poison Guard S)
|
||||
メンタルガード (Mental Guard)
|
||||
メンタルガードS (Mental Guard S)
|
||||
TP+ (TP+)
|
||||
エネミーレーダー (Enemy Radar)
|
||||
ワーニングベル (Warning Bell)
|
||||
TPストッカー (TP Stocker)
|
||||
ガッツリング (Guts Ring)
|
||||
MPキーパー (MP Keeper)
|
||||
エレメンタルガード (Elemental Guard)
|
||||
スペクタクル (Spectacle)
|
||||
|
||||
#Enemies
|
||||
ゴブリン (Goblin)
|
||||
ノーム (Gnome)
|
||||
クロウ (Crow)
|
||||
トレント (Treant)
|
||||
魔犬 (Hellhound)
|
||||
バットン (Batton)
|
||||
山賊 (Bandit)
|
||||
ハッチン (Hatchin)
|
||||
女王ハッチン (Queen Hatchin)
|
||||
騎士 (Knight)
|
||||
赤騎士 (Red Knight)
|
||||
パンダン (Pandan)
|
||||
キノコン (Kinokon)
|
||||
マンドレ (Mandre)
|
||||
トレントン (Trenton)
|
||||
レッドラン (Redran)
|
||||
サイクロップ (Cyclops)
|
||||
ハーピィ (Harpy)
|
||||
ミノタウロス (Minotaur)
|
||||
強ミノタウロス (Strong Minotaur)
|
||||
暴漢 (Thug)
|
||||
ゴブゴブリン (Gobgoblin)
|
||||
レジスタンス (Resistance)
|
||||
騎士 (Knight)
|
||||
バイバットン (Bybatton)
|
||||
悪魔犬 (Demon Dog)
|
||||
マキシマムシ (Maximum Bug)
|
||||
ストーカー (Stalker)
|
||||
ナナハッチン (Nanahatchin)
|
||||
スライン (Sline)
|
||||
ミミックン (Mimicun)
|
||||
ドットレントン (Dot Renton)
|
||||
ブタン (Butan)
|
||||
ミツハッチン (Mitsuhatchin)
|
||||
野盗 (Bandit)
|
||||
鎧の男 (Armored Man)
|
||||
ボスオークン (Boss Orkun)
|
||||
オークン (Orkun)
|
||||
シュードの男 (Shude Man)
|
||||
ボスネークン (Boss Snakun)
|
||||
コスネークン (Kosnakun)
|
||||
グレートパンダン (Great Pandan)
|
||||
テスト (Test)
|
||||
ゴブリソ (Goblinso)
|
||||
ボスネークン (Boss Snakun)
|
||||
復讐者 (Avenger)
|
||||
```
|
||||
Loading…
Reference in a new issue