python TextMining
01.Crawling
url_request
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 17 11:08:44 2019
@author: 502-03
1.anaconda Prompt실행
2.python -m pip install --upgrade pip
3.pip install beautifulsoup4
"""
import urllib.request #url 요청
from bs4 import BeautifulSoup #html 파씽
url="http://www.naver.com/index.html"
#1.원격서버 파일 요청
rst=urllib.request.urlopen(url)
print(rst) #<http.client.HTTPResponse object at 0x000000000E21F940>
data_src=rst.read() #source read
print(data_src)
"""
b'<!doctype html>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<html lang="ko">\n<head>
....
"""
#2.html 파싱:src->html문서
html=data_src.decode('utf-8') #디코딩
soup=BeautifulSoup(html,'html.parser')
print(soup)
"""
</script>
<title>NAVER</title>
</meta></meta></meta></meta></meta></head>
<style>
"""
#3.tag기반 수집
link=soup.find('a') #하나만 가져옴
print(link)
"""
<a href="#news_cast" onclick="document.getElementById('news_cast2').tabIndex = -1;
document.getElementById('news_cast2').focus();return false;">
<span>연합뉴스 바로가기</span></a>
"""
print('a tag 내용',link.string)#a tag 내용 연합뉴스 바로가기
links=soup.find_all('a')#전부 가져오기
print('a tag size',len(links))#a tag size 335
links_data=[] #빈 리스트
print(a.string)
links_data.append(a.string)
print("links_data",len(links_data))#links_data 341
print(links_data)
"""
['연합뉴스 바로가기', '주제별캐스트 바로가기', '타임스퀘어 바로가기', '쇼핑캐스트 바로가기', '로그인 바로가기',
....
'네이버 정책', '고객센터', 'NAVER Corp.']
"""
selector
# -*- coding: utf-8 -*-
"""
- 선택자(selector) 이용 문서 수집
-> 웹 문서 디자인(css)
-> id(#), class(.)
-> select_one('선택자') : 하나 요소 추출
-> select('선택자') : 여러 개 요소 추출
"""
from bs4 import BeautifulSoup #html 파싱
#1.html파일 가져오기
file=open("../data/selector.html",mode='r',encoding='utf-8')
data_src=file.read()
print(data_src)
"""
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>id/class 선택자, 표 꾸미기</title>
<style type="text/css">
"""
#2.html파싱
html=BeautifulSoup(data_src,'html.parser')
print(html)
"""
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>id/class 선택자, 표 꾸미기</title>
<style type="text/css">
"""
#3.selector 기반 수집
#1) id선택자: selector("tab#id명"))
table=html.select_one('table#tab')
print(table)
"""
<table border="1" id="tab">
<tr> <!-- 1행 -->
<!-- 제목 열 : th -->
<th id="id"> 학번 </th>
...
<td> you@naver.com </td>
</tr>
</table>
"""
#2)id 선택자 >하위 태그
th=html.select_one('table#tab > tr > th')
print(th) #<th id="id"> 학번 </th>
ths=html.select('table#tab > tr > th')
print(ths)
"""
[<th id="id"> 학번 </th>, <th id="name"> 이름 </th>, <th id="major"> 학과 </th>, <th id="email"> 이메일 </th>]
"""
for th in ths:#<th id="id"> 학번 </th>
print(th.string)
"""
학번
이름
학과
이메일
"""
#2) class 선택 :select('tag.class명')
# -5행->홀수 행
# (1) 계층적 접근
trs=html.select('table#tab > tr.odd')
print(trs)
"""
[<tr class="odd"> <!-- 3행(홀수) -->
<td> 201602 </td>
<td> 이순신 </td>
<td> 해양학과 </td>
<td> lee@naver.com </td>
</tr>, <tr class="odd"> <!-- 5행 -->
<td> 201604 </td>
<td> 유관순 </td>
<td> 유아교육 </td>
<td> you@naver.com </td>
</tr>]
"""
tds_data=[]
for tr in trs:# 2회
tds=tr.find_all('td')
for td in tds:
print(td.string)
tds_data.append(td.string)
"""
201602
이순신
해양학과
lee@naver.com
201604
유관순
유아교육
you@naver.com
"""
#(2) 직접 접근 :tag[속성=값]
trs=html.select('tr[class=odd]')
print(trs)
"""
[<tr class="odd"> <!-- 3행(홀수) -->
<td> 201602 </td>
<td> 이순신 </td>
<td> 해양학과 </td>
<td> lee@naver.com </td>
</tr>, <tr class="odd"> <!-- 5행 -->
<td> 201604 </td>
<td> 유관순 </td>
<td> 유아교육 </td>
<td> you@naver.com </td>
</tr>]
"""
newsCrawling
# -*- coding: utf-8 -*-
"""
news Crawling
url='http://media.daum.net'
"""
import requests #url 요청
from bs4 import BeautifulSoup #html 파싱
url='http://media.daum.net'
#1.url 요청
src=requests.get(url)
print(src) #<Response [200]>
data_src=src.text # source text
#2.html 파싱
html=BeautifulSoup(data_src,'html.parser')
print(html)
#3.select(tag[속성=값])
# <strong class="tit_g"><a href="http://v.media.daum.net/v/20190217083008573" class="link_txt">美, 방위비 또 두 자릿수 인상 요구 가능성..韓 대응 방안은</a><span class="txt_view">뉴시스</span></strong>
links=html.select("a[class=link_txt]")
creawling_data=[]#내용저장
cnt =0;
for link in links:
cnt+=1
cont=str(link.string) #문자 변환
#print(cont)
print(cnt,'-',cont.strip()) # 줄바꿈 ,공백 ,불용어 제거
creawling_data.append(cont.split())
"""
1 - 트럼프 "무역협상 생산적..中 수십억달러 관세로 내"
2 - "미중 무역전쟁..지적재산권 마찰도 큰 변수"
3 - 트럼프도 시진핑도 긍정적 자평..기로에 선 무역전쟁
4 - 미·중 무역전쟁 '휴전' 연장 가능성..우리나라 영향은...
5 - 中언론도 무역협상 낙관론.."미중 모두를 위한 합의해야...
"""
#변수 ->text file save
file=open('../data/crawling_data.txt',
mode='w',encoding='utf-8')
#list -> str 변환
file.write(str(creawling_data))
file.close()
print("file save commit")
02.NLP
jpype_test
# -*- coding: utf-8 -*- """ java 가상머신 사용여부 """ import jpype path=jpype.getDefaultJVMPath() print(path)#C:\Program Files\Java\jdk1.8.0_181\jre\bin\server\jvm.dll
konlpy
# -*- coding: utf-8 -*-
"""
konlpy인스톨 여부
pip install konlpy
"""
from konlpy.tag import Kkma
#Kkma object
kkma=Kkma()
#문단 -> 문장 추출
para="형태소 분석을 사장입니다.나는 홍길동 이고 age는 28세 입니다."
ex_sent=kkma.sentences(para)
print(ex_sent)
"""
['형태소 분석을 사장입니다.', '나는 홍길동 이고 age는 28세 입니다.']
"""
#문단 -> 명사 추출
ex_nouns=kkma.nouns(para)
print(ex_nouns)
"""
['형태소', '분석', '사장', '나', '홍길동', '28', '28세', '세']
"""
#문단 -> 형태소 추출
ex_pos=kkma.pos(para)
print(ex_pos) #[(text,text class)]
"""
[('형태소', 'NNG'), ('분석', 'NNG'), ('을', 'JKO'), ('사장', 'NNG'), ('이', 'VCP'),
('ㅂ니다', 'EFN'), ('.', 'SF'), ('나', 'NP'), ('는', 'JX'), ('홍길동', 'NNG'),
('이', 'VCP'), ('고', 'ECE'), ('age', 'OL'), ('는', 'JX'), ('28', 'NR'),
('세', 'NNM'), ('이', 'VCP'), ('ㅂ니다', 'EFN'), ('.', 'SF')]
"""
'''
형태소 : 언어에 있어서 분해 가능한 최소한의 의미를 가진 단위
NNG 일반 명사 NNP 고유 명사 NNB 의존 명사 NR 수사 NP 대명사 VV 동사
VA 형용사 VX 보조 용언 VCP 긍정 지정사 VCN 부정 지정사 MM 관형사
MAG 일반 부사 MAJ 접속 부사 IC 감탄사 JKS 주격 조사 JKC 보격 조사
JKG 관형격 조사 JKO 목적격 조사 JKB 부사격 조사 JKV 호격 조사
JKQ 인용격 조사 JC 접속 조사 JX 보조사 EP 선어말어미 EF 종결 어미
EC 연결 어미 ETN 명사형 전성 어미 ETM 관형형 전성 어미 XPN 체언 접두사
XSN 명사파생 접미사 XSV 동사 파생 접미사 XSA 형용사 파생 접미사 XR 어근
SF 마침표, 물음표, 느낌표 SE 줄임표 SS 따옴표,괄호표,줄표
SP 쉼표,가운뎃점,콜론,빗금 SO 붙임표(물결,숨김,빠짐)
SW 기타기호 (논리수학기호,화폐기호) SH 한자 SL 외국어 SN 숫자
NF 명사추정범주 NV 용언추정범주 NA 분석불능범
'''
#NNG:일반 명사 NNP:고유 명사 NP:대명사
ex_pos2=[] #명사 추출
for (text,text_class) in ex_pos:#(text,text class)
if text_class=='NNG' or text_class=='NNP' or text_class=='NP':
ex_pos2.append(text)
print(ex_pos2)#['형태소', '분석', '사장', '나', '홍길동']
03.WordCloud
ex_nouns
# -*- coding: utf-8 -*-
"""
1.test file 읽기
2.명사 추출 : Kkma
3.전처리 :단어 길이 제한 ,숫자 제이
4.word cloud시각화
"""
from konlpy.tag import Kkma
#object
kkma=Kkma()
#1.text file읽기
file=open("../data/text_data.txt",mode='r',encoding="utf-8")
docs=file.read() #text전체 읽기
file.close()
print(docs)
"""
형태소 분석을 시작합니다. 나는 데이터 분석을 좋아합니다.
직업은 데이터 분석 전문가 입니다. Text mining 기법은 2000대 초반에 개발된 기술이다.
"""
#1).doc -> sentence
ex_sent=kkma.sentences(docs)
print(ex_sent)
"""
['형태소 분석을 시작합니다.',
'나는 데이터 분석을 좋아합니다.',
'직업은 데이터 분석 전문가 입니다.',
'Text mining 기법은 2000대 초반에 개발된 기술이다.']
"""
for sent in ex_sent:
print(sent)
"""
형태소 분석을 시작합니다.
나는 데이터 분석을 좋아합니다.
직업은 데이터 분석 전문가 입니다.
Text mining 기법은 2000대 초반에 개발된 기술이다.
"""
#2).docs -> nount 추출
ex_nouns=kkma.nouns(docs) #중복 명사 추출 않됨
print(ex_nouns)
"""
['형태소', '분석', '나', '데이터', '직업', '전문가',
'기법', '2000', '2000대', '대', '초반', '개발', '기술']
"""
from re import match
#2~3.중복 단어 추출 -> 전처리 과정(숫자,길이 1개 제외)
nouns_words =[]#list
nouns_count={} #set or dict
for sent in ex_sent:#문장들
for nouns in kkma.nouns(sent):#단어들
#전처리 (숫자,길이 1개 제외)
if len(str(nouns))>1 and not(match('^[0-9]',nouns)):
nouns_words.append(nouns)
#key=word :value:count
nouns_count[nouns]=nouns_count.get(nouns,0)+1
print(len(nouns_words))#15->12
"""
['형태소', '분석', '데이터', '분석', '직업', '데이터',
'분석', '전문가', '기법', '초반', '개발', '기술']
"""
print(nouns_count)
"""
{'형태소': 1, '분석': 3, '데이터': 2, '직업': 1,
'전문가': 1, '기법': 1, '초반': 1, '개발': 1, '기술': 1}
"""
#4.word cloud시각화
from collections import Counter
#1)dict->Counter 객체
word_count=Counter(nouns_count)
#2)top word
top5=word_count.most_common(5)
print(top5)
"""
[('분석', 3), ('데이터', 2), ('형태소', 1), ('직업', 1), ('전문가', 1)]
"""
#3)word cloud 시각화 :package 시각
import pytagcloud
'''
Anaconda Prompt에서
pip install pygame
pip install pytagcloud
pip install simplejson
'''
# tag에 color, size, tag 사전 구성
word_count_list = pytagcloud.make_tags(top5, maxsize=80)
# maxsize : 최대 글자크기
print(word_count_list)
'''
[{'color': (91, 34, 34), 'size': 109, 'tag': '분석'}, {'color': (95, 159, 59), 'size': 80, 'tag': '데이터'}, {'color': (194, 214, 193), 'size': 47, 'tag': '형태소'}]
'''
pytagcloud.create_tag_image(word_count_list,
'wordcloud.jpg',
size=(900, 600),
fontname='korean', rectangular=False)
'''
한글 단어 구름 시각화 Error 수정
C:\Anaconda3\Lib\site-packages\pytagcloud\fonts 폴더에서
1. fonts.json 파일 내용 수정
[
{
"name": "korean",
"ttf": "malgun.ttf",
2. C:\Windows\Fonts 폴더에서 '맑은 고딕' 서체 복사/fonts 폴더 붙여넣기
3. create_tag_image(fontname='korean') 속성 추가
'''
news_wordCloud
# -*- coding: utf-8 -*-
"""
news crawling data file
- word cloud 시각화
"""
from konlpy.tag import Kkma
#object 생성
kkma =Kkma()
#1.text file load
file=open("../data/crawling_data.txt",
encoding='utf-8')
crawling_data=file.read()
file.close()
print(crawling_data)
"""
[['트럼프', '"무역협상', '생산적..中', '수십억달러', '관세로', '내"'],
['"미중', '무역전쟁..지적재산권', '마찰도', '큰', '변수"'],
['트럼프도', '시진핑도', '긍정적', '자평..기로에', '선', '무역전쟁'],
...
['베니스', '비엔날레', '작가', '선정에', '송성각', '관여', '의혹', '관련', '정정보도문']]
"""
#2.docs-> sentences 추출
ex_sent=kkma.sentences(crawling_data)
print(ex_sent)
#3문장->명사 추출
# 4. text 전처리 : 숫자, 1개 단어 제외
# 5. word count : dict
ex_nouns=[] #list
word_count={} #dict
for sent in ex_sent:# 문장들
for nouns in kkma.nouns(sent):# 단어들
if len(str(nouns))>1 and not(match('^[0-9]',nouns)):
ex_nouns.append(nouns)
word_count[nouns]=word_count.get(nouns,0)+1
print(ex_nouns)
print(word_count)
# 5. Counter 객체 : top10 추출
from collections import Counter
word_count=Counter(word_count)
top10=word_count.most_common(10)
print(top10)
"""
[('미', 4), ('트럼프', 3), ('억', 3), ('중', 3), ('선', 3), ('조', 3), ('정', 3), ('정정보', 3), ('정보', 3), ('문', 3)]
"""
# 6. word cloud 시각화
import pytagcloud
'''
Anaconda Prompt에서
pip install pygame
pip install pytagcloud
pip install simplejson
'''
# tag에 color, size, tag 사전 구성
word_count_list = pytagcloud.make_tags(top10, maxsize=80)
# maxsize : 최대 글자크기
print(word_count_list)
'''
[{'color': (91, 34, 34), 'size': 109, 'tag': '분석'}, {'color': (95, 159, 59), 'size': 80, 'tag': '데이터'}, {'color': (194, 214, 193), 'size': 47, 'tag': '형태소'}]
'''
pytagcloud.create_tag_image(word_count_list,
'news_wordcloud.jpg',
size=(900, 600),
fontname='korean', rectangular=False)
'''
한글 단어 구름 시각화 Error 수정
C:\Anaconda3\Lib\site-packages\pytagcloud\fonts 폴더에서
1. fonts.json 파일 내용 수정
[
{
"name": "korean",
"ttf": "malgun.ttf",
2. C:\Windows\Fonts 폴더에서 '맑은 고딕' 서체 복사/fonts 폴더 붙여넣기
3. create_tag_image(fontname='korean') 속성 추가
'''
04.SparseMatrix
TfidfVectorizer
# -*- coding: utf-8 -*-
"""
TfidfVectorizer 기능 : Tfidf(가중치 적용 방법) 단어 벡터 생성기
1. 단어 생성기 : 문장 -> 단어(word)
2. 단어 사전(word dict) : {word : 고유수치}
3. 희소 행렬(sparse matrix) : 단어 출현비율에 따른 가중치(TF, TFiDF)
1) TF : 단어 출현빈도수 -> 가중치 적용(빈도수 높은 가중 높다.)
2) TFiDF : 단어 출현빈도수 x 문서 출현빈도수에 역수(단어 중요도)
-> TFiDF = tf(d, t) x log(n/df(t))
"""
from sklearn.feature_extraction.text import TfidfVectorizer
#문장
sentences = [
"Mr. Green killed Colonel Mustard in the study with the candlestick. Mr. Green is not a very nice fellow.",
"Professor Plum has a green plant in his study.",
"Miss Scarlett watered Professor Plum's green plant while he was away from his office last week."
]
#1.단어 생성기:문장->단어(word)
tfidf_fit=TfidfVectorizer().fit(sentences)
print(tfidf_fit)#object info
"""
TfidfVectorizer(analyzer='word', binary=False, decode_error='strict',
dtype=<class 'numpy.int64'>, encoding='utf-8', input='content',
lowercase=True, max_df=1.0, max_features=None, min_df=1,
ngram_range=(1, 1), norm='l2', preprocessor=None, smooth_idf=True,
stop_words=None, strip_accents=None, sublinear_tf=False,
token_pattern='(?u)\\b\\w\\w+\\b', tokenizer=None, use_idf=True,
vocabulary=None)
"""
#2.단어 사전(word dict) : {word:고유수치}
voca=tfidf_fit.vocabulary_
print('word size=',len(voca))#word size= 31
print(voca)# 'mr': 14, #14는 고유숫자
"""
{'mr': 14, 'green': 5, 'killed': 11, 'colonel': 2, 'mustard': 15, 'in': 9,
'the': 24, 'study': 23, 'with': 30, 'candlestick': 1, 'is': 10, 'not': 17,
'very': 25, 'nice': 16, 'fellow': 3, 'professor': 21, 'plum': 20, 'has': 6,
'plant': 19, 'his': 8, 'miss': 13, 'scarlett': 22, 'watered': 27, 'while': 29,
'he': 7, 'was': 26, 'away': 0, 'from': 4, 'office': 18, 'last': 12, 'week': 28}
"""
#영문자 오름차순:word embedding
#3.희소 행렬(sparse matrix) :text:분석 DTM(행:D ,열:T)
tfidf=TfidfVectorizer()#object
sparse_tfidf=tfidf.fit_transform(sentences)
print(type(sparse_tfidf))#<class 'scipy.sparse.csr.csr_matrix'>
print(sparse_tfidf.shape)#DTM=(3행(Doc), 31열(Term))
print("1.scipy.sparse.matrix")
print(sparse_tfidf)
"""
(row:doc,col:term) 가중치 (weight)=Tfidf
(0, 14) 0.4411657657527482:'mr'
(0, 5) 0.26055960805891015:'green'
(1, 5) 0.2690399207469689 :'green'
(1, 8) 0.34643788271971976
(2, 5) 0.15978698032384395
(2, 21) 0.2057548299742193
(2, 20) 0.2057548299742193
...
"""
print("2.numpy sparse.matrix")
#scipy->numpy 형변환
tfidf_arr=sparse_tfidf.toarray()
print(tfidf_arr.shape) #(3, 31)
print(type(tfidf_arr))#<class 'numpy.ndarray'>
print(tfidf_arr)
"""
[[0. 0.22058288 0.22058288 0.22058288 0. 0.26055961
0. 0. 0. 0.16775897 0.22058288 0.22058288
0. 0. 0.44116577 0.22058288 0.22058288 0.22058288
0. 0. 0. 0. 0. 0.16775897
0.44116577 0.22058288 0. 0. 0. 0.
0.22058288]
[0. 0. 0. 0. 0. 0.26903992
0.45552418 0. 0.34643788 0.34643788 0. 0.
0. 0. 0. 0. 0. 0.
0. 0.34643788 0.34643788 0.34643788 0. 0.34643788
0. 0. 0. 0. 0. 0.
0. ]
[0.27054288 0. 0. 0. 0.27054288 0.15978698
0. 0.27054288 0.20575483 0. 0. 0.
0.27054288 0.27054288 0. 0. 0. 0.
0.27054288 0.20575483 0.20575483 0.20575483 0.27054288 0.
0. 0. 0.27054288 0.27054288 0.27054288 0.27054288
0. ]]
"""
"""
1.scipy sparse matrix
-> tensorflow model
2.numpy sparse matrix
-> sklean model
"""
python TextMining的更多相关文章
- [Python] 机器学习库资料汇总
声明:以下内容转载自平行宇宙. Python在科学计算领域,有两个重要的扩展模块:Numpy和Scipy.其中Numpy是一个用python实现的科学计算包.包括: 一个强大的N维数组对象Array: ...
- python数据挖掘领域工具包
原文:http://qxde01.blog.163.com/blog/static/67335744201368101922991/ Python在科学计算领域,有两个重要的扩展模块:Numpy和Sc ...
- [resource]Python机器学习库
reference: http://qxde01.blog.163.com/blog/static/67335744201368101922991/ Python在科学计算领域,有两个重要的扩展模块: ...
- [转]Python机器学习工具箱
原文在这里 Python在科学计算领域,有两个重要的扩展模块:Numpy和Scipy.其中Numpy是一个用python实现的科学计算包.包括: 一个强大的N维数组对象Array: 比较成熟的(广播 ...
- python版本及ML库
一:关于Python版本的选择问题 关于Python的选择问题:要看学术界能不能把科学库迁移到Python3. 1:多个版本共用: 最近发现SciPy的最高版本是3.2,只能是退而求其次,不使用最新版 ...
- Python中的多进程与多线程(一)
一.背景 最近在Azkaban的测试工作中,需要在测试环境下模拟线上的调度场景进行稳定性测试.故而重操python旧业,通过python编写脚本来构造类似线上的调度场景.在脚本编写过程中,碰到这样一个 ...
- Python高手之路【六】python基础之字符串格式化
Python的字符串格式化有两种方式: 百分号方式.format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存.[PEP-3101] This ...
- Python 小而美的函数
python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况 any any(iterable) ...
- JavaScript之父Brendan Eich,Clojure 创建者Rich Hickey,Python创建者Van Rossum等编程大牛对程序员的职业建议
软件开发是现时很火的职业.据美国劳动局发布的一项统计数据显示,从2014年至2024年,美国就业市场对开发人员的需求量将增长17%,而这个增长率比起所有职业的平均需求量高出了7%.很多人年轻人会选择编 ...
随机推荐
- Hdoj 1425.sort 题解
Problem Description 给你n个整数,请按从大到小的顺序输出其中前m大的数. Input 每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行包含 ...
- 07Axios
详情:https://pizzali.github.io/2018/10/30/Axios/ JQuery时代,我们使用ajax向后台提交数据请求,Vue时代,Axios提供了前端对后台数据请求的各种 ...
- IIS运行一段时间不响应的解决方法
查找事件记录,提示为应用程序池 'DefaultAppPool' 提供服务的进程关闭时间超过了限制 解决方案: Internet 信息服务(IIS)管理器->应用程序池->DefaultA ...
- RabbitMQ队列的使用
为什么要用RabbitMQ 以常见的订单系统为例,用户点击[下单]按钮之后的业务逻辑可能包括:扣减库存.生成相应单据.发红包.发短信通知.在业务发展初期这些逻辑可能放在一起同步执行,随着业务的发展订单 ...
- Mycat的读写分离
1. Mycat实现读写分离的部署: https://www.cnblogs.com/softidea/p/5447566.html springboot动态数据源的原理以及配置: Spring内置了 ...
- kafka 基础知识梳理及集群环境部署记录
一.kafka基础介绍 Kafka是最初由Linkedin公司开发,是一个分布式.支持分区的(partition).多副本的(replica),基于zookeeper协调的分布式消息系统,它的最大的特 ...
- IDEA破解
1. 官网下载 idea激活 进入 C:\Windows\System32\drivers\etc 编辑host文件 加入0.0.0.0 account.jetbrains.com 2.打开ID ...
- LFYZ-OJ ID: 1021 邮票问题
邮票问题 Problem Description 设有已知面额的邮票m种,每种有n张,用总数不超过n张的邮票,能从面额1开始,最多连续组成多少面额.(1≤m≤100,1≤n≤100,1≤邮票面额≤25 ...
- JavaScript 的正则也有单行模式了
正则表达式最早是由 Ken Thompson 于 1970 年在他改进过的 QED 编辑器里实现的,正则里最简单的元字符 “.” 在当时所匹配的就是除换行符外的任意字符: "." ...
- String.intern() 方法__jdk1.6与jdk1.7/jdk1.8的不同
1.为什么要使用intern()方法 intern方法设计的初衷是为了重用string对象,节省内存 用代码实例验证下 public class StringInternTest { static f ...