Acdong
Learn by doing
Acdong
전체 방문자
오늘
어제
  • 분류 전체보기
    • Economy
      • Saving Money
    • Self-improvement
    • Thoughts
    • Machine learning
      • Deep Learning
      • Chatbot
      • NLP
    • MLops
      • AWS
      • Container
      • Serving
    • Computer Vision
    • Data Science
      • ADsP
      • R
    • Project
    • Python
      • Data Structure & Algorithm
    • C,C++
    • API
      • ElasticSearch
    • Error Note
    • Network
    • RDBMS
      • SQL

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

  • [GitHub]

인기 글

태그

  • R시각화
  • R
  • 포인터
  • Numpy
  • 다중공선성
  • 이미지 전처리
  • SentenceTransformer
  • 머신러닝
  • pandas
  • sbert
  • 존댓말 반말 분류
  • nlp
  • 데이터 전처리
  • 회귀계수
  • c포인터
  • 어텐션
  • R그래프
  • plot()
  • Python
  • 기계학습

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
Acdong

Learn by doing

Machine learning/NLP

[NLP]. 텍스트 데이터 정제(이모지 , 특수문자, url , 한자 제거)

2022. 12. 21. 10:18
728x90
import re
import emoji
from soynlp.normalizer import repeat_normalize

pattern = re.compile(f'[^ .,?!/@$%~%·∼()\x00-\x7Fㄱ-ㅣ가-힣]+')
url_pattern = re.compile(
    r'https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)')

def clean(x): 
    x = pattern.sub(' ', x)
    x = emoji.replace_emoji(x, replace='') #emoji 삭제
    x = url_pattern.sub('', x)
    x = x.strip()
    x = repeat_normalize(x, num_repeats=2)
    return x

 

참고 : 

https://github.com/Beomi/KcELECTRA

 

반응형
저작자표시 비영리 (새창열림)

'Machine learning > NLP' 카테고리의 다른 글

[NLP] KakaoGPT 사용해서 존댓말/반말 변환하기  (0) 2023.01.04
[NLP]. SentenceTransformer Tokenize 멀티턴 형식으로 수정하기  (0) 2022.12.22
[NLP]. SentenceTransformer 모델 TensorFlow로 불러오기  (0) 2022.12.12
[NLP]. Sentence-Transformer 모델 onnx 형식으로 변환하기  (0) 2022.12.12
[NLP]. 오타 생성기 구현하기 : Text Noise Augmentation  (1) 2022.10.29
    'Machine learning/NLP' 카테고리의 다른 글
    • [NLP] KakaoGPT 사용해서 존댓말/반말 변환하기
    • [NLP]. SentenceTransformer Tokenize 멀티턴 형식으로 수정하기
    • [NLP]. SentenceTransformer 모델 TensorFlow로 불러오기
    • [NLP]. Sentence-Transformer 모델 onnx 형식으로 변환하기
    Acdong
    Acdong
    E-mail : alswhddh@naver.com / 자연어처리와 MLops 를 연구하고 있는 스타트업 개발자입니다.

    티스토리툴바