ginipick commited on
Commit
262da5d
·
verified ·
1 Parent(s): f0f9c07

Update src/main.py

Browse files
Files changed (1) hide show
  1. src/main.py +14 -1
src/main.py CHANGED
@@ -43,7 +43,20 @@ def normalize_quotes(text):
43
  # 불필요한 공백 제거
44
  text = re.sub(r'\s+', ' ', text).strip()
45
 
46
- # 번째 단어에만 따옴표 처리
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  words = text.split()
48
  if words:
49
  # 모든 따옴표 제거 후 첫 단어에만 따옴표 추가
 
43
  # 불필요한 공백 제거
44
  text = re.sub(r'\s+', ' ', text).strip()
45
 
46
+ # 이미 따옴표로 묶인 단어가 있는지 확인
47
+ existing_quotes = re.findall(r"'([^']*)'", text)
48
+ if existing_quotes:
49
+ return text # 이미 따옴표가 있으면 그대로 반환
50
+
51
+ # 대문자로 된 단어 찾기 (예: JOHN)
52
+ uppercase_words = re.findall(r'\b[A-Z]+\b', text)
53
+ if uppercase_words:
54
+ # 대문자 단어에 따옴표 추가
55
+ for word in uppercase_words:
56
+ text = text.replace(word, f"'{word}'")
57
+ return text
58
+
59
+ # 위의 조건에 해당하지 않는 경우 첫 단어에 따옴표 추가
60
  words = text.split()
61
  if words:
62
  # 모든 따옴표 제거 후 첫 단어에만 따옴표 추가