Update LANGREGEX in all

This commit is contained in:
DazedAnon 2025-01-02 11:43:47 -06:00
parent 50bce1d4c8
commit 8fd7c608fd
22 changed files with 724 additions and 659 deletions

View file

@ -46,6 +46,9 @@ BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
POSITION = 0
LEAVE = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.

View file

@ -47,6 +47,9 @@ BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
POSITION = 0
LEAVE = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.

View file

@ -44,6 +44,9 @@ IGNORETLTEXT = True # Ignores all translated text.
MISMATCH = [] # Lists files that thdata a mismatch error (Length of GPT list response is wrong)
BRACKETNAMES = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -429,7 +432,7 @@ def getSpeaker(speaker):
return [NAMESLIST[i][1], [0, 0]]
# If there isn't any Japanese in the text just skip
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", speaker):
if not re.search(LANGREGEX, speaker):
return [speaker, [0, 0]]
# Translate and Store Speaker
@ -628,7 +631,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -47,6 +47,9 @@ POSITION = 0
LEAVE = False
PBAR = None
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.

File diff suppressed because it is too large Load diff

View file

@ -46,6 +46,9 @@ BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
POSITION = 0
LEAVE = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.

View file

@ -46,6 +46,9 @@ BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
POSITION = 0
LEAVE = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.

View file

@ -47,6 +47,9 @@ BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
POSITION = 0
LEAVE = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -496,7 +499,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -46,6 +46,9 @@ BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
POSITION = 0
LEAVE = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.

View file

@ -54,6 +54,10 @@ SPEAKERS = True
CHOICES = True
DIALOGUE = True
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -539,7 +543,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -49,6 +49,9 @@ BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
POSITION = 0
LEAVE = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.

View file

@ -55,6 +55,9 @@ ascii_to_wide.update({0x20: "\u3000", 0x2D: "\u2212"}) # space and minus
wide_to_ascii = dict((i, chr(i - 0xFEE0)) for i in range(0xFF01, 0xFF5F))
wide_to_ascii.update({0x3000: " ", 0x2212: "-"}) # space and minus
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -555,7 +558,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -49,6 +49,9 @@ POSITION = 0
LEAVE = False
PBAR = None
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -550,7 +553,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -49,6 +49,9 @@ POSITION = 0
LEAVE = False
PBAR = None
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -479,7 +482,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -49,6 +49,9 @@ BRACKETNAMES = False
PBAR = None
FILENAME = None
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -1276,7 +1279,7 @@ def searchCodes(page, pbar, jobList, filename):
# If there isn't any Japanese in the text just skip
if not re.search(
r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+",
LANGREGEX,
jaString,
):
i += 1
@ -1302,7 +1305,7 @@ def searchCodes(page, pbar, jobList, filename):
# If there isn't any Japanese in the text just skip
if not re.search(
r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+",
LANGREGEX,
jaString,
):
i += 1
@ -1456,7 +1459,7 @@ def searchCodes(page, pbar, jobList, filename):
continue
# If there isn't any Japanese in the text just skip
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", jaString):
if not re.search(LANGREGEX, jaString):
i += 1
continue
@ -1590,7 +1593,7 @@ def searchCodes(page, pbar, jobList, filename):
jaString = codeList[i]["p"][0]
# If there isn't any Japanese in the text just skip
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", jaString):
if not re.search(LANGREGEX, jaString):
i += 1
continue
@ -1635,7 +1638,7 @@ def searchCodes(page, pbar, jobList, filename):
jaString = codeList[i]["p"][0]
# If there isn't any Japanese in the text just skip
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", jaString):
if not re.search(LANGREGEX, jaString):
i += 1
continue
@ -1955,7 +1958,7 @@ def searchCodes(page, pbar, jobList, filename):
continue
# If there isn't any Japanese in the text just skip
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", jaString):
if not re.search(LANGREGEX, jaString):
i += 1
continue
@ -2562,7 +2565,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -46,7 +46,7 @@ MISMATCH = [] # Lists files that throw a mismatch error (Length of GPT list res
PBAR = None
FILENAME = None
# Regex - Need to change this if you want to translate from/to other languages
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# Pricing - Depends on the model https://openai.com/pricing
@ -83,11 +83,11 @@ CODE101 = False # Turn this one when names exist in 101
CODE408 = False # Warning, translates comments and can inflate costs.
# Variables
CODE122 = False
CODE122 = True
# Other
CODE355655 = False
CODE357 = True
CODE357 = False
CODE657 = False
CODE356 = False
CODE320 = False
@ -1148,7 +1148,7 @@ def searchCodes(page, pbar, jobList, filename):
## Event Code: 122 [Set Variables]
if "code" in codeList[i] and codeList[i]["code"] == 122 and CODE122 is True:
# This is going to be the var being set. (IMPORTANT)
if codeList[i]["parameters"][0] not in list(range(42, 45)):
if codeList[i]["parameters"][0] not in list(range(95, 96)):
i += 1
continue
@ -1549,25 +1549,26 @@ def searchCodes(page, pbar, jobList, filename):
## Event Code: 355 or 655 Scripts [Optional]
if "code" in codeList[i] and (codeList[i]["code"] == 355 or codeList[i]["code"] == 655) and CODE355655 is True:
jaString = codeList[i]["parameters"][0]
regex = r'.*subject=(.*?)"'
regexPatterns = [r'.*subject=(.*?)"', r"テキスト-(.*)"]
# Var Text
match = re.search(regex, jaString)
if re.search(regex, jaString):
finalJAString = match.group(1)
# Pass 1
if setData is False:
list355655.append(finalJAString)
# Iterate over the list of regex patterns
for regex in regexPatterns:
match = re.search(regex, jaString)
if re.search(regex, jaString):
finalJAString = match.group(1)
# Pass 1
if setData is False:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = translatedText.replace("'", "\\'")
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = translatedText.replace("'", "\\'")
# Set
codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(finalJAString, translatedText)
list355655.pop(0)
# Set
codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(finalJAString, translatedText)
list355655.pop(0)
## Event Code: 408 (Script)
if "code" in codeList[i] and (codeList[i]["code"] == 408) and CODE408 is True:

View file

@ -48,6 +48,9 @@ POSITION = 0
LEAVE = False
PBAR = None
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -470,7 +473,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -49,6 +49,9 @@ POSITION = 0
LEAVE = False
PBAR = None
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -468,7 +471,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -49,6 +49,9 @@ POSITION = 0
LEAVE = False
PBAR = None
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -542,7 +545,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -55,6 +55,9 @@ ascii_to_wide.update({0x20: "\u3000", 0x2D: "\u2212"}) # space and minus
wide_to_ascii = dict((i, chr(i - 0xFEE0)) for i in range(0xFF01, 0xFF5F))
wide_to_ascii.update({0x3000: " ", 0x2212: "-"}) # space and minus
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -482,7 +485,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
continue

View file

@ -46,6 +46,9 @@ MISMATCH = [] # Lists files that throw a mismatch error (Length of GPT list res
FILENAME = None
BRACKETNAMES = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -2344,7 +2347,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]

View file

@ -47,6 +47,9 @@ BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
POSITION = 0
LEAVE = False
# Regex - Need to change this if you want to translate from/to other languages. Default is Japanese Regex
LANGREGEX = r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+"
# 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
# If you are getting a MISMATCH LENGTH error, lower the batch size.
@ -507,7 +510,7 @@ def translateGPT(text, history, fullPromptFlag):
subbedT = varResponse[0]
# Things to Check before starting translation
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---\uFF61-\uFF9F]+", subbedT):
if not re.search(LANGREGEX, subbedT):
if PBAR is not None:
PBAR.update(len(tItem))
history = tItem[-MAXHISTORY:]