Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

필수 사전 & 언어 모델 빌드 기능 API화하여 노출 #39

Open
bab2min opened this issue Sep 4, 2021 · 1 comment
Open

필수 사전 & 언어 모델 빌드 기능 API화하여 노출 #39

bab2min opened this issue Sep 4, 2021 · 1 comment

Comments

@bab2min
Copy link
Owner

bab2min commented Sep 4, 2021

현재 KiwiBuilder에 전처리된 사전 데이터로부터 KiwiBuilder를 생성하는 기능은 추가되어 있음.

Kiwi/include/kiwi/Kiwi.h

Lines 169 to 171 in 844474e

void loadMMFromTxt(std::istream&& is, MorphemeMap& morphMap, std::unordered_map<POSTag, float>* posWeightSum, const std::function<bool(float, POSTag)>& selector);
void loadCMFromTxt(std::istream&& is, MorphemeMap& morphMap);
void loadPCMFromTxt(std::istream&& is, MorphemeMap& morphMap);

또 말뭉치로부터 언어모델을 학습하는 기능도 하드코딩으로 구현은 되어있음.

Kiwi/src/KiwiBuilder.cpp

Lines 364 to 369 in 844474e

Vector<Vector<uint16_t>> sents;
addCorpusTo(sents, ifstream{ rawDataPath + "/ML_lit.txt" }, realMorph);
addCorpusTo(sents, ifstream{ rawDataPath + "/ML_spo.txt" }, realMorph);
vector<pair<uint16_t, uint16_t>> bigramList;
auto cntNodes = utils::count(sents.begin(), sents.end(), 1, 1, 3, nullptr, &bigramList);
langMdl = lm::KnLangModelBase::create(lm::KnLangModelBase::build(cntNodes, 3, 1, 2, 0, 1, 1e-5, 8, false, &bigramList));

ModelGenerator 폴더 내에 파이썬 스크립트로 중구난방으로 작성되어 있는 원본 말뭉치 -> 전처리된 사전 데이터 추출부를 다듬어 API 형태로 제공하고, 위의 기능들도 잘 다듬어 API로 노출한다면 말뭉치만 있으면 누구나 쉽게 형태소 분석 모델을 구축할 수 있는 시스템을 제공할 수 있을 것.

이렇게하여 다양한 형태소 분석 모델을 학습할 수 있게 한다면 이용자 각자가 자신의 목적에 맞는 모델을 선택하거나 직접 구축하여 사용할 수 있어서 매우 유용할 것으로 보인다.

@bab2min bab2min changed the title 사전 & 언어 모델 빌드 기능 API화하여 노출 필수 사전 & 언어 모델 빌드 기능 API화하여 노출 Sep 4, 2021
@bab2min bab2min added this to 진행 중 in 향후 개발 계획 Sep 4, 2021
@bab2min bab2min mentioned this issue Mar 9, 2022
@bab2min
Copy link
Owner Author

bab2min commented Mar 20, 2022

해당 기능은 0.11.0버전에서 https://github.com/bab2min/Kiwi/blob/main/tools/model_builder.cpp 에 일부 구현되었습니다. 추후 모델 학습 기능은 완전히 API에 통합시켜 더욱 간단하게 커스텀 형태소 분석 모델을 구축할 수 있게 지원할 예정입니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 진행 중
Development

No branches or pull requests

1 participant