728x90
def number_fillter(self,input_text):
# 연속된 숫자 필터
nf = re.compile("(\d{8,20})")
# 휴대폰번호 필터
pn = re.compile("(\d{2,6}[ -]-?\d{2,6}[ -]-?\d{2,6})")
# 계좌번호 필터
ac = re.compile("(\d{2,6}[ -]-?\d{2,6}[ -]-?\d{2,6}[ -]-?\d{2,6})")
#검색
if pn.search(input_text):
return 1
elif ac.search(input_text):
return 1
elif nf.search(input_text):
return 1
else:
return 0
주소
personal_patterns = {
"ad1": r"(\S+[시,도])\s?(\S+[구,군])\s?(\S+)\s?(\d{1,5}(-\d{1,5})?)?",
"ad2": r"(\S+[시,도])\s?(\S+[구,군])\s?(\S+)\s?(\d{1,5})\s?(길|로|길|로)\s?(\d{1,5}(-\d{1,5})?)?",
"ad3": r"([가-힣A-Za-z·\d~\-.]+(읍|동|번지)\s)[\d]+",
"ad4": r"([가-힣a-zA-Z\d]+(아파트|빌라|빌딩|마을|동|호))",
}
반응형
'Machine learning > NLP' 카테고리의 다른 글
[annotation]. 텍스트 데이터 라벨링 꿀팁(1) (0) | 2021.11.12 |
---|---|
[NLP]. 한국어 맞춤법 검사기 사용하기 (feat. hanspell ) (0) | 2021.10.27 |
[전처리]. 한국어 존댓말과 반말을 구별하는 방법(feat. komoran) (0) | 2021.10.14 |
[NLP] . 자연어처리 프로젝트 파일 구조 ( 인공지능 디자인 패턴 ) (0) | 2021.09.05 |
[NLP] BERT - (1).구조와 개념 (0) | 2021.09.04 |