ratsgo / embedding

한국어 임베딩 (Sentence Embeddings Using Korean Corpora)
https://ratsgo.github.io/embedding
MIT License
452 stars 129 forks source link

FastText 실행코드 관련 문의 #56

Closed ByungSunBae closed 4 years ago

ByungSunBae commented 4 years ago

안녕하세요.

교재 p.131의 코드 4-8

mkdir -p data/word-embeddings/fasttext
models/fastText/fasttext skipgram -input data/tokenized/corpus_mecab.txt -output data/word-embeddings/fasttext/fasttext

이 부분에서 models 폴더내 fastText 경로 자체가 없습니다.

혹시 업데이트 하실 계획 있으신가요?

hccho2 commented 4 years ago

windows 이면, https://github.com/xiamx/fastText/releases 여기서 download하시면 됩니다.

ByungSunBae commented 4 years ago

@hccho2 제 PC는 우분투 입니다. 아쉽네요..ㅠㅠ fasttext는 따로 다운로드 받아서 실행해야하나요? 한국어 임베딩 교재의 깃허브에 있는줄 알았는데 없어서 드린 질문입니다.

hccho2 commented 4 years ago

다음과 같이 할 수도 있습니다. pip install fasttext

import fasttext
input_path = 'ratings_mecab.txt'
model = fasttext.train_unsupervised(input=input_path, model='skipgram')
model.save_model("my-fasttext.bin")
ratsgo commented 4 years ago

@ByungSunBae 님 도서에 있는 스크립트는 도커 컨테이너에서 수행하는 걸 전제로 제시된 것입니다. 만약 도커 컨테이너에서 실행하지 않는다면 @hccho2 님 말씀대로 하셔도 되고요. 아래처럼 해도 됩니다.

git clone https://github.com/facebookresearch/fastText.git
cd fastText
make
pip install .

참고로 도서에 제시된 도커 컨테이너를 실행한다면 해당 fastText 패키지가 이미 설치돼 있습니다. 이는 우리 레파지토리 Dockerfile을 참고하세요. 두 분 모두 감사드립니다.