Skip to content

Commit

Permalink
Clean up formatting again
Browse files Browse the repository at this point in the history
  • Loading branch information
ThioJoe committed Jan 14, 2024
1 parent 7c14bb4 commit 3d57a99
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Scripts/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,7 @@ def combine_single_pass(entryListLocal, charRateGoal, gapThreshold, maxCharacter
considerNext = False
else:
considerNext = True

# Check if current entry is still in the list - if it has been combined with another entry, it will not be



# Get the char_rate of the next and previous entries, if they exist, and calculate the difference
# If the diff is positive, then it is lower than the current char_rate
try:
Expand Down Expand Up @@ -488,7 +485,6 @@ def combine_with_prev():
entryListLocal[i-1]['srt_timestamps_line'] = entryListLocal[i-1]['srt_timestamps_line'].split(' --> ')[0] + ' --> ' + entryListLocal[i]['srt_timestamps_line'].split(' --> ')[1]
del entryListLocal[i]


# Choose whether to consider next and previous entries, and if neither then continue to next loop
if data['char_rate'] > charRateGoal:
# Check to ensure next/previous rates are lower than current rate, and the combined entry is not too long, and the gap between entries is not too large
Expand Down Expand Up @@ -587,4 +583,4 @@ def calc_list_speaking_rates(inputList, charRateGoal, dictKey='translated_text')
tempList[i]['char_rate'] = round(len(tempList[i][dictKey]) / (int(tempList[i]['duration_ms']) / 1000), 2)
# Calculate the difference between the current char_rate and the goal char_rate - Absolute Value
tempList[i]['char_rate_diff'] = abs(round(tempList[i]['char_rate'] - charRateGoal, 2))
return tempList
return tempList

0 comments on commit 3d57a99

Please sign in to comment.