Giter Site home page Giter Site logo

inkyscope / embedding Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ratsgo/embedding

0.0 0.0 0.0 512 KB

한국어 임베딩 (Sentence Embeddings Using Korean Corpora)

Home Page: https://ratsgo.github.io/embedding

License: MIT License

Shell 7.35% Python 87.87% C++ 4.41% Makefile 0.38%

embedding's Introduction

embedding tutorials

본 레파지토리는 자연언어처리의 근간이 되는 각종 임베딩 기법들에 관련한 튜토리얼입니다. 한국어 처리를 염두에 두고 작성됐습니다. 본 레파지토리에 있는 코드를 실행하면 corpus preprocess, embedding, fine-tuning 등을 수행할 수 있습니다. 이 모든 과정을 안내하는 튜토리얼 페이지는 다음과 같습니다.

book

본 튜토리얼은 다음 도서를 보완하기 위해 작성됐습니다. 도서를 구매하지 않아도 튜토리얼 수행에 문제는 없으나 일부 내용은 도서를 참고해야 그 맥락을 완전하게 이해할 수 있습니다. 다음 그림을 클릭하면 도서 구매 사이트로 이동합니다.

embedding methods

본 튜토리얼에서 다루는 임베딩 기법은 다음과 같습니다.

  • 단어 수준 임베딩
    • Latent Semantic Analysis
    • Word2Vec
    • GloVe
    • FastText
    • Swivel
  • 문장 수준 임베딩
    • Weighted Embeddings
    • Latent Semantic Analysis
    • Latent Dirichlet Allocation
    • Doc2Vec
    • Embeddings from Language Models (ELMo)
    • Bidirectional Encoder Representations from Transformer (BERT)

corpus preprocess

임베딩 학습데이터를 만들기 위해서는 전처리(preprocess)를 해야 합니다. 본 튜토리얼에서 다루는 오픈소스 패키지는 다음과 같습니다.

embedding fine-tuning

네이버 영화 리뷰 말뭉치(NSMC)를 가지고 임베딩을 파인튜닝하는 방법을 실습합니다. 영화 댓글(문서)를 입력으로 하고 긍/부정 극성(polarity)을 분류하는 태스크를 수행합니다. 본 튜토리얼에서 다루는 임베딩 파인튜닝 기법은 다음과 같습니다.

  • 문장 수준 임베딩 활용 : Word2Vec, FastText, Swivel + Bi-LSTM with attention layer
  • ELMo 활용 : ELMo layer + Bi-LSTM with attention layer
  • BERT 활용 : BERT layer + Fully-connected layer

code

본 레파지토리의 디렉토리 및 코드 구조는 다음과 같습니다.

  • docker : 도커 환경 구성을 위한 Dockerfile이 있습니다. CPU, GPU 버전을 구분합니다.
  • docs : 튜토리얼 페이지와 관련한 마크다운 문서 등이 있습니다.
  • models : 임베딩 기법 관련 핵심 코드가 모여 있습니다.
    • bert : BERT 모델 (저자 original 코드)
    • bilm : ELMo 모델 (저자 original 코드)
    • swivel : Swivel 모델 (저자 original 코드)
    • xlnet : XLNet 모델 (저자 original 코드)
    • sent_eval.py : 문장 임베딩 평가 코드
    • sent_utils.py : 문장 임베딩 학습 관련 유틸
    • train_elmo.py : ELMo 프리트레인 코드 (저자 original 코드, 하이퍼파라미터 일부 수정)
    • tune_utils.py : 임베딩 파인튜닝 관련 유틸
    • visualize_utils.py : 임베딩 시각화 관련 유틸
    • word_eval.py : 단어 임베딩 평가 코드
    • word_utils.py : 단어 임베딩 학습 관련 유틸
  • preprocess : 말뭉치 전처리 관련 코드가 모여 있습니다.
    • dump.py : 원시 말뭉치(raw corpus)를 1개 라인(line)이 1개 문서인 순수 텍스트 파일로 변환하는 유틸
    • mecab-user-dic.csv : 은전한닢(mecab) 형태소 분석기의 사용자 사전을 추가하기 위한 입력 파일
    • supervised_nlputils.py : KoNLPy, Khaiii 등 지도학습 기반 형태소 분석기 유틸
    • unsupervised_nlputils.py : soynlp, sentencepiece 등 비지도학습 기반 형태소 분석기 유틸
  • preprocess.sh : 말뭉치 전처리 자동화 스크립트 모음
  • sentmodel.sh : 문장 수준 임베딩 자동화 스크립트 모음
  • wordmodel.sh : 단어 수준 임베딩 자동화 스크립트 모음

embedding's People

Contributors

ratsgo avatar black7375 avatar gyunggyung avatar jaemkim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.