Adjust namepop regex
This commit is contained in:
parent
6083b25165
commit
3e45c22de2
3 changed files with 20 additions and 21 deletions
|
|
@ -145,7 +145,7 @@ def translateJS(data, pbar):
|
|||
i = 0
|
||||
|
||||
# Regex & Plugin Name
|
||||
regex = r'Description[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
regex = r'ObjectiveContent[\\]+":[\\]+"[\\]+"(.*?)[\\]+"'
|
||||
|
||||
# Find Plugin
|
||||
while i < len(data):
|
||||
|
|
@ -158,7 +158,7 @@ def translateJS(data, pbar):
|
|||
|
||||
# Remove Wordwrap [Optional]
|
||||
for j in range(len(modifiedStringList)):
|
||||
modifiedStringList[j] = modifiedStringList[j].replace(r'\\\\n', r' ')
|
||||
modifiedStringList[j] = modifiedStringList[j].replace(r'\\\\\\\\n', r' ')
|
||||
|
||||
# Translate
|
||||
response = translateGPT(modifiedStringList, f'Reply with the {LANGUAGE} translation', True, pbar)
|
||||
|
|
@ -170,11 +170,11 @@ def translateJS(data, pbar):
|
|||
if len(translatedList) == len(modifiedStringList):
|
||||
for j in range(len(translatedList)):
|
||||
# Add escape for '
|
||||
translatedList[j] = translatedList[j].replace("'", "\\'")
|
||||
translatedList[j] = re.sub(r"[^\\](')", "\\'", translatedList[j])
|
||||
|
||||
# Wordwrap [Optional]
|
||||
translatedList[j] = textwrap.fill(translatedList[j], LISTWIDTH)
|
||||
translatedList[j] = translatedList[j].replace('\n', r'\\\\n')
|
||||
translatedList[j] = translatedList[j].replace('\n', r'\\\\\\\\n')
|
||||
|
||||
# Set
|
||||
data[i] = data[i].replace(stringList[j], translatedList[j])
|
||||
|
|
@ -307,14 +307,12 @@ def batchList(input_list, batch_size):
|
|||
|
||||
def createContext(fullPromptFlag, subbedT):
|
||||
characters = 'Game Characters:\n\
|
||||
シラス ティア ナナシユエル (Silas Tia Nanasiyuel) - Female\n\
|
||||
レイラ プラム ナナシユエル (Leila Plum Nanasiyuel) - Female\n\
|
||||
アリア グランツ (Aria Granz) - Female\n\
|
||||
ソフィー グリーンウッド (Sophie Greenwood) - Female\n\
|
||||
ヨウコ マッカーシー (Yoko McCarthy) - Female\n\
|
||||
ルフィナ アリーニア (Rufina Arinia) - Female\n\
|
||||
ヘレナ ルオ アルバネル (Helena Luo Albaner) - Female\n\
|
||||
アウローラ パパス (Aurora Pappas) - Female\n\
|
||||
皆月 (Minazuki)\n\
|
||||
さやか (Sayaka)\n\
|
||||
皆月 さやか (Minazuki Sayaka) - Female\n\
|
||||
広瀬 (Hirose)\n\
|
||||
智恵 (Chie) - Female\n\
|
||||
広瀬 智恵 (Hirose Chie) - Female\n\
|
||||
'
|
||||
|
||||
system = PROMPT + VOCAB if fullPromptFlag else \
|
||||
|
|
|
|||
|
|
@ -56,24 +56,24 @@ POSITION = 0
|
|||
LEAVE = False
|
||||
|
||||
# Dialogue / Scroll
|
||||
CODE401 = True
|
||||
CODE405 = True
|
||||
CODE401 = False
|
||||
CODE405 = False
|
||||
CODE408 = False
|
||||
|
||||
# Choices
|
||||
CODE102 = True
|
||||
CODE102 = False
|
||||
|
||||
# Variables
|
||||
CODE122 = False
|
||||
|
||||
# Names
|
||||
CODE101 = True
|
||||
CODE101 = False
|
||||
|
||||
# Other
|
||||
CODE355655 = False
|
||||
CODE357 = False
|
||||
CODE657 = False
|
||||
CODE356 = False
|
||||
CODE356 = True
|
||||
CODE320 = False
|
||||
CODE324 = False
|
||||
CODE111 = False
|
||||
|
|
@ -228,7 +228,7 @@ def parseMap(data, filename):
|
|||
if event is not None:
|
||||
# This translates ID of events. (May break the game)
|
||||
if '<namePop:' in event['note']:
|
||||
response = translateNoteOmitSpace(event, r'<namePop: (.*?) >')
|
||||
response = translateNoteOmitSpace(event, r'<namePop:(.*?)\s.+')
|
||||
totalTokens[0] += response[0]
|
||||
totalTokens[1] += response[1]
|
||||
|
||||
|
|
@ -1029,7 +1029,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
## Event Code: 122 [Set Variables]
|
||||
if 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 [297, 298, 299]:
|
||||
if codeList[i]['parameters'][0] not in list(range(0,2000)):
|
||||
continue
|
||||
|
||||
jaString = codeList[i]['parameters'][4]
|
||||
|
|
@ -1064,7 +1064,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
translatedText = translatedText.replace(char, '')
|
||||
|
||||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, width=60)
|
||||
translatedText = textwrap.fill(translatedText, width=30)
|
||||
translatedText = translatedText.replace('\n', '\\n')
|
||||
translatedText = '\"' + translatedText + '\"'
|
||||
|
||||
|
|
@ -1951,7 +1951,7 @@ def createContext(fullPromptFlag, subbedT):
|
|||
皆月 さやか (Minazuki Sayaka) - Female\n\
|
||||
広瀬 (Hirose)\n\
|
||||
智恵 (Chie) - Female\n\
|
||||
広瀬 智恵 (Hirose Chie) - Femal\n\
|
||||
広瀬 智恵 (Hirose Chie) - Female\n\
|
||||
'
|
||||
|
||||
system = PROMPT + VOCAB if fullPromptFlag else \
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ Here are some vocabulary and terms so that you know the proper spelling and tran
|
|||
持っている数 (Owned)
|
||||
ME 音量 (ME Volume)
|
||||
回想する (Recollection)
|
||||
回 (x)
|
||||
|
||||
# Other
|
||||
パパ (papa)
|
||||
|
|
|
|||
Loading…
Reference in a new issue