konolpy 환경설정 오류

ganadara·2023년 2월 8일
1

project

목록 보기
4/9
post-thumbnail

colab에서 hanspell 실행하기

def word_clean(df):
    from hanspell import spell_checker
    import re
    from tqdm import tqdm
    CHANGE_FILTER = re.compile("([~!?\"':;&)(])") #제외할 문자
    okt = Okt()
    X_train = []
    for i,sentence in tqdm(enumerate(df)):
        sentence = re.sub(CHANGE_FILTER, "", sentence) #문자 제외
        ok = spell_checker.check(sentence) # 맞춤법 확인
        sentence = ok.checked #바꾼 문자로 변경
        clean_words = []
        for word in okt.pos(sentence):
            if word[1] in ['Noun', 'Modifier', 'Alpha']: #명사, 관형사(가끔 나와서), 영어
                 clean_words.append(word[0]) #찾아진 것 중 단어만 추가
        sentence = ' '.join(clean_words)
        X_train.append(sentence)
#         print(i,sentence)
    return X_train
!pip install git+https://github.com/ssut/py-hanspell.git

!pip install pyspellcheck, !pip install spellcheck 아님

konolpy java오류

SystemError: java.nio.file.InvalidPathException: Illegal char <*> at index 42: C:\anaconda\Lib\site-packages\konlpy\java\*

처음 colab으로 실행했다 jupyter에서 실행해야 됬었다.

  • 환경설정
    JDK 1.8 이상, Python 3.6 이상, konlpy==0.6.0 이상
  • 오류:'java.lang.String' object has no attribute 'rsplit'

python 다운그레이드

conda activate (가상환경이름)
conda install python=3.8

오류: Ignoring invalid distribution -pype1

~로 시작하는 폴더 지우기

해결

vscode로 실행

환경설정 어렵다.

profile
DL 공부중

2개의 댓글

comment-user-thumbnail
2023년 2월 16일

헐 대박

답글 달기
comment-user-thumbnail
2023년 2월 17일

저는 그래서 이제 KIWI 써요 ㅠ

답글 달기