mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
fix
This commit is contained in:
parent
4e40bf1d0a
commit
7a502772fb
@ -22,28 +22,26 @@ def dedump(line, args):
|
|||||||
|
|
||||||
|
|
||||||
def _2_f(line, args):
|
def _2_f(line, args):
|
||||||
|
if len(line) == 0:
|
||||||
|
return
|
||||||
keepnodump = args["保持非重复字符"]
|
keepnodump = args["保持非重复字符"]
|
||||||
times = args["重复次数(若为1则自动分析去重)"]
|
times = args["重复次数(若为1则自动分析去重)"]
|
||||||
|
|
||||||
if times >= 2:
|
if times >= 2:
|
||||||
guesstimes = times
|
guesstimes = times
|
||||||
else:
|
else:
|
||||||
guesstimes = []
|
dumptime = Counter()
|
||||||
t1 = 1
|
cntx = 1
|
||||||
for i in range(1, len(line)):
|
lastc = None
|
||||||
if line[i] == line[i - 1]:
|
for c in line:
|
||||||
|
if c != lastc:
|
||||||
t1 += 1
|
dumptime[cntx] += 1
|
||||||
|
lastc = c
|
||||||
|
cntx = 1
|
||||||
else:
|
else:
|
||||||
|
cntx += 1
|
||||||
guesstimes.append(t1)
|
_max = max(dumptime.values())
|
||||||
t1 = 1
|
guesstimes = sorted(dumptime.keys(), key=lambda x: x * (dumptime[x] != _max))[0]
|
||||||
x = Counter(guesstimes)
|
|
||||||
|
|
||||||
if len(guesstimes) != 0:
|
|
||||||
guesstimes = sorted(x.keys(), key=lambda x1: x[x1])[-1]
|
|
||||||
else:
|
|
||||||
guesstimes = 1
|
|
||||||
if keepnodump:
|
if keepnodump:
|
||||||
newline = ""
|
newline = ""
|
||||||
i = 0
|
i = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user