IT 17

np.unravel_index() 설명 및 사용예시 정리

Function Signature numpy.unravel_index(indices, shape, order='C') shape = (M, N) 으로 주어질 때, Matrix (M, N) 내 원소는 0 부터 M * N-1 까지 존재한다고 가정 indicies = index: int (or indicies: list of int)가 위치한 좌표를 나타냄 예시1 : np.unravel_index(6, (3, 4)) shape: (3, 4) -> np.arange(12).reshape(3, 4) = 0~11 로 채워진 M = 3, N =4인 matrix 0 1 2 (return j) 3 0 0 1 2 3 1 (return i) 4 5 6 (index) 7 2 8 9 10 11 (1, 2) 예시2 : np.ar..

IT/Python 2022.11.15

Elastic Search DSL search query 기초

index 정보 호출 # es 내에 설치된 모든 index(=table) 정보 호출 GET _cat/indicesmapping 정보 호출 # index의 mapping(=schema) 정보 호출 GET dev_recommend_storage_cst_mart/_searchsearch query - match_all # index 내 모든 documents return GET dev_recommend_storage_prd_mart/_search { "query": { "match_all": {} } } # GET dev_recommend_storage_prd_mart/_search 와 동일search query - term (query vs. filter) # score가 반환되는 일반 query # gen..

IT/Elasticsearch 2021.04.19

Elastic Search 기본 개념 및 차이점

검색엔진 ES는 기본적으로검색엔진이다. 기본 DB와 가장 다른점은 쿼리이후 결과값이(document = row)마다 쿼리의 조건문과 얼마나 적합한지를 나타내는 score를 얻을 수 있다. 즉 단순히 조건절에 의해 True(1)/False(0)에 해당하는 결과값만 취하는게 아니라 각 결과값마다 유사한 정도(relevance score, 0.9 / 0.2)를 뽑아낼 수 있다. 참고 : 검색엔진은 주로 텍스트를 많이 담고 있어서 “검색어“가 document와 비슷한지 보여주는 것은 매우 중요한 ㅣㄹ이다. (참고) 분산 저장 및 처리 방식 score vs. filter query를 날리다 보면 score를 항상 필요로 하지 않는 경우도 존재한다. score는 필요하지 않고 filter만 필요한 경우 :고객의 성..

IT/Elasticsearch 2021.04.19

ubuntu에서 python cx_oracle로 oracle 접근

글을 쓰게 된 이유 conda 로 설치하면 conda를 찾지 못하는 오류가 빈번하게 발생하여 수동 설치하게 됨 가상환경 관리가 특별히 필요없는 base 등에 설치할 때 이 방법을 추천 docker 이미지로 올릴 때는 conda를 이용하는 것을 추천 오라클 인스턴트 클라이언트 다운로드 https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html 위의 링크에서 instantclient-basic-linux.x64-11.2.0.4.0.zip, instantclient-sqlplus-linux.x64-11.2.0.4.0.zip 두 zip 파일을 다운로드 오라클 인스턴트 클라이언트 설치하기 (remote server일..

IT/linux 2019.10.16

nori pos tag summary

1. nori 품사 태그 정리 descrition 설명 예시 표시 E Verbal endings 동사 어미 드리겠습니다 → 드리/겠/습니다 IC Interjection 감탄사 어머나, 헐 J Ending Particle 조사 배송으로 불편을 → 배송/으로/불편/을 MAG General Adverb 일반부사 복 많이 받으세요 → 복/많이/받/으/세요 MAJ Conjunctive adverb 접속부사 모바일 또는 유선으로 → 모바일/또는/유선/으로 MM Modifier 수식어/한정어 총 3개, 7일 내 NA Unknown NNB Dependent noun 의존명사 입구쪽, 받을수, 곰보난것처럼 NNBC Dependent noun 의존명사 12일, 15시 NNG General Noun 일반명사 배송기사님 → ..

IT/Elasticsearch 2019.02.09

Elastic Search analyse process (analyser + tokeniser + tokenfilter)

Elastic Search analyse process 1. analysis(분석) : 색인 할 때 입력된 데이터가 검색어를 추출하기 위해 거치는 프로세스분석과정 : tokenizer → token filter https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html 2. analyser(분석기) : 분석 과정에서 사용하는 프로그램하나의 tokenizer, n개의 token filter로 구성custom analyser : 사용자가 상황에 맞게 tokenizer와 token_filter를 조합하여 analyser를 구성e.g. standard analyser, simple analyser, whitespace analyse..

IT/Elasticsearch 2019.02.09

logstash error - unrecognized SSL message

logstash로 pipeline을 구축하는 도중에 exception으로 Unrecognized SSL message라는 에러가 종종 발생한다. 1) ManticoreManticore::UnknownException: Unrecognized SSL message, plaintext connection? 이라고 뜨면 대부분 SSL 관련된 문제라고 인식하고, 문제를 해결하려고 한다. 하지만 Manticore와 관련된 에러는 대부분 http와 관련되어 있으므로 http와 관련된 설정 등을 의심해보자. 필자의 경우에는 logstash.yml 내에 xpack.monitoring 관련 elasticsearch url 설정에 문제가 있었다. 2) OpenSSL OpenSSL::SSL::SSLError: Unrecog..

IT/Elasticsearch 2018.11.12

nori, arirang, openkoreantext, mecab 형태소분석기 사전형식

Nori 사전 형식 .{ES_HOME}/config/user_dic.txtc++ C샤프 세종 세종시 세종 시 결과 : c++ => c++ c샤프 => c샤프 세종 => 세종 세종시 => 세종 시 (default) // 세종시 => 세종시 세종 시 (optional) https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-nori-tokenizer.html Arirang 사전 형식 분해전 단어:분해후단어1,분해후단어2,…,분해후단어N:DBXX 분해전 단어에 하여(다)동사(D), 되어(다)동사(B) 가 붙을 수 있는지 확인해야 함 (D : True = 1, False = 0 / B : True =1, False = 0) 객관화:객관,화:..

IT/Elasticsearch 2018.11.08

synonyms token filter 에서 lenient란??

lenient를 한국말로하면 관대한이라는 뜻이다. 무엇이 관대한지 알아보자. lenient의 default값은 false이고, true일 경우 관대해져서 동의어 필터를 적용하며 생기는 exception들을 모두 무시한다. 동의어 필터를 적용하며 생기는 문제는 다음과 같다. curl -X PUT "localhost:9200/test_index" -H 'Content-Type: application/json' -d' { "settings": { "index" : { "analysis" : { "analyzer" : { "synonym" : { "tokenizer" : "standard", "filter" : ["my_stop", "synonym"] } }, "filter" : { "my_stop": { "t..

IT/Elasticsearch 2018.11.08