Browse Source

update: multi-check process

master
Dnomd343 2 years ago
parent
commit
4be71ca3af
  1. 15
      src/punctuation/check.py

15
src/punctuation/check.py

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import sys
import json import json
from itertools import product from itertools import product
@ -55,12 +56,16 @@ def pairsCheck(sentence: str) -> bool:
if len(punctuationStack) != 0 or errorFlag: # something error in sentence if len(punctuationStack) != 0 or errorFlag: # something error in sentence
for punctuation in reversed(punctuationStack): # replenish missing punctuation for punctuation in reversed(punctuationStack): # replenish missing punctuation
sentence.append(colorful(punctuation[1], 35)) sentence.append(colorful(punctuation[1], 35))
print(''.join(sentence)) print('%s\n%s' % ('-' * 128, ''.join(sentence)))
return False return False
return True # no error match in sentence return True # no error match in sentence
data = loadContent('rc-3') def contentCheck(content: list) -> None:
for row in data: for row in content: # pairs check
if not pairsCheck(row): pairsCheck(row)
print() print('-' * 128)
# other check process
contentCheck(loadContent(sys.argv[1]))

Loading…
Cancel
Save