250x250
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- RESFUL
- 과학백과사전
- oracle
- 지마켓
- 토픽추출
- 네이버뉴스
- jsp 파일 설정
- 파이썬
- Topics
- pytorch
- lda
- 幼稚园杀手(유치원킬러)
- db
- tomoto
- word2vec
- test
- 코사인 유사도
- r
- spring MVC(모델2)방식
- java
- 게시판 만들기
- (깃)git bash
- 이력서
- Python
- 자바
- Gmarket
- 크롤링
- 방식으로 텍스트
- mysql
- Websocket
Archives
- Today
- Total
무회blog
python: 200529-python-test002ldaModel-토픽추출 본문
from gensim import corpora
from gensim.models import LsiModel
from gensim.parsing.preprocessing import preprocess_string
import re
def clean_text(x):
pattern = r'[^a-zA-Z0-9\s]'
text = re.sub(pattern,'',x)
return x
def clean_numbers(x):
if bool(re.search(r'\d',x)):
x = re.sub('[0-9]{5,}','#####',x)
x = re.sub('[0-9]{4,}','####',x)
x = re.sub('[0-9]{3,}','###',x)
x = re.sub('[0-9]{2,}','##',x)
return x
def clean(x):
x = clean_text(x)
x = clearn_numbers(x)
return x
'Python' 카테고리의 다른 글
python: 200601- 파이썬 워드클라우드 그리기(konlpy, nltk) (0) | 2020.06.01 |
---|---|
python: 200529-python_문서내 단어 빈도 분석 (0) | 2020.05.29 |
python: 200529-python-test001 ldaModel-토픽추출 (0) | 2020.05.29 |
python:200526-pyDB_ver001.02, - insert 다건 , executemany() (0) | 2020.05.26 |
python:200526-pyDB-001.003, insert, 단건(oracle) (0) | 2020.05.25 |
Comments