display name and tyrano changes

This commit is contained in:
Dazed 2023-11-06 13:07:47 -06:00
parent 0198872506
commit 165a1b99ae
3 changed files with 19 additions and 9 deletions

View file

@ -195,6 +195,12 @@ def parseMap(data, filename):
events = data['events']
global LOCK
# Translate displayName for Map files
if 'Map' in filename:
response = translateGPT(data['display_name'], 'Reply with only the english translation of the RPG location name', False)
totalTokens += response[1]
data['display_name'] = response[0].replace('\"', '')
# Get total for progress bar
for key in events:
if key is not None:

View file

@ -559,7 +559,7 @@ def searchCodes(page, pbar):
# Color Regex: ^([\\]+[cC]\[[0-9]\]+(.+?)[\\]+[cC]\[[0]\])
matchList = re.findall(r'(.*?([\\]+[nN]<(.+?)>).*)', finalJAString)
if len(matchList) > 0:
response = translateGPT(matchList[0][2], 'Reply with only the english translation of the NPC name', True)
response = translateGPT(matchList[0][2], 'Reply with only the english translation of the NPC name', False)
tokens += response[1]
speaker = response[0].strip('.')
nametag = matchList[0][1].replace(matchList[0][2], speaker)
@ -724,15 +724,19 @@ def searchCodes(page, pbar):
# Translate
if speaker == '' and finalJAString != '':
response = translateGPT(finalJAString, 'Past Translated Text: (' + ', '.join(textHistory) + ')', True)
response = translateGPT(finalJAString, textHistory, True)
tokens += response[1]
translatedText = response[0]
# Remove added speaker
translatedText = re.sub(r'^.+?:\s?', '', translatedText)
# Sub Vars
varResponse = subVars(translatedText)
subbedT = varResponse[0]
textHistory.append('\"' + varResponse[0] + '\"')
elif finalJAString != '':
response = translateGPT(speaker + ': ' + finalJAString, 'Past Translated Text: (' + ', '.join(textHistory) + ')', True)
response = translateGPT(speaker + ': ' + finalJAString, textHistory, True)
tokens += response[1]
translatedText = response[0]

View file

@ -159,7 +159,7 @@ def translateTyrano(data, pbar):
translatedText = data[i].replace(matchList[0], translatedText.replace(' ', '\u00A0'))
data[i] = translatedText
# Lines
# Grab Lines
matchList = re.findall(r'(.+?)\[p\]', data[i])
if len(matchList) > 0:
matchList[0] = matchList[0].replace('', '')
@ -203,8 +203,8 @@ def translateTyrano(data, pbar):
translatedText = response[0]
textHistory.append('\"' + translatedText + '\"')
# Remove added speaker
translatedText = re.sub(r'^.+:\s?', '', translatedText)
# Remove added speaker
translatedText = re.sub(r'^.+:\s?', '', translatedText)
# Set Data
translatedText = translatedText.replace('', '')
@ -268,7 +268,7 @@ def translateTyrano(data, pbar):
currentGroup = []
speaker = ''
# pcm Line
# Grab Lines [p][cm]
matchList = re.findall(r'(.+?)\[p\]\[cm\]', data[i])
if len(matchList) > 0:
matchList[0] = matchList[0].replace('', '')
@ -291,8 +291,8 @@ def translateTyrano(data, pbar):
translatedText = response[0]
textHistory.append('\"' + translatedText + '\"')
# Remove added speaker
translatedText = re.sub(r'^.+:\s?', '', translatedText)
# Remove added speaker
translatedText = re.sub(r'^.+:\s?', '', translatedText)
# Set Data
translatedText = translatedText.replace('', '')