wiizm commited on
Commit
8a5ca1e
Β·
verified Β·
1 Parent(s): 2d16c34

Upload app\routes.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app//routes.py +7 -0
app//routes.py CHANGED
@@ -1938,6 +1938,9 @@ def convert_episode_format(content):
1938
  for line in lines:
1939
  converted_line = line
1940
 
 
 
 
1941
  # @μˆ«μžν™” νŒ¨ν„΄ (곡백 포함/미포함)
1942
  converted_line = re.sub(r'^@\s*(\d+)\s*ν™”\s*', r'#\1ν™”', converted_line)
1943
 
@@ -1950,6 +1953,10 @@ def convert_episode_format(content):
1950
  # 쀄 μ‹œμž‘μ—μ„œ 숫자둜 μ‹œμž‘ν•˜κ³  λ°”λ‘œ "ν™”"κ°€ μ˜€λŠ” 경우
1951
  if not re.search(r'^#\d+ν™”', converted_line):
1952
  converted_line = re.sub(r'^(\d+)\s*ν™”\s*', r'#\1ν™”', converted_line)
 
 
 
 
1953
 
1954
  # #0nν™” νŒ¨ν„΄μ—μ„œ μ•žμ˜ 0 제거 (#01ν™” -> #1ν™”, #010ν™” -> #10ν™”)
1955
  # 단, #0ν™”λŠ” κ·ΈλŒ€λ‘œ μœ μ§€
 
1938
  for line in lines:
1939
  converted_line = line
1940
 
1941
+ # ν”„λ‘€λ‘œκ·Έ 처리 (@ν”„λ‘€λ‘œκ·Έ, #ν”„λ‘€λ‘œκ·Έ -> #0ν™” ν”„λ‘€λ‘œκ·Έ)
1942
+ converted_line = re.sub(r'^[@#]\s*ν”„λ‘€λ‘œκ·Έ\s*', '#0ν™” ν”„λ‘€λ‘œκ·Έ', converted_line)
1943
+
1944
  # @μˆ«μžν™” νŒ¨ν„΄ (곡백 포함/미포함)
1945
  converted_line = re.sub(r'^@\s*(\d+)\s*ν™”\s*', r'#\1ν™”', converted_line)
1946
 
 
1953
  # 쀄 μ‹œμž‘μ—μ„œ 숫자둜 μ‹œμž‘ν•˜κ³  λ°”λ‘œ "ν™”"κ°€ μ˜€λŠ” 경우
1954
  if not re.search(r'^#\d+ν™”', converted_line):
1955
  converted_line = re.sub(r'^(\d+)\s*ν™”\s*', r'#\1ν™”', converted_line)
1956
+
1957
+ # #숫자 νŒ¨ν„΄ (ν™”κ°€ μ—†λŠ” 경우) - #n -> #nν™”
1958
+ if not re.search(r'^#\d+ν™”', converted_line):
1959
+ converted_line = re.sub(r'^#\s*(\d+)(?!ν™”)\s*', r'#\1ν™”', converted_line)
1960
 
1961
  # #0nν™” νŒ¨ν„΄μ—μ„œ μ•žμ˜ 0 제거 (#01ν™” -> #1ν™”, #010ν™” -> #10ν™”)
1962
  # 단, #0ν™”λŠ” κ·ΈλŒ€λ‘œ μœ μ§€