Giter Site home page Giter Site logo

py-hanspell's Introduction

py-hanspell

Build Status PyPI version

py-hanspell은 네이버 맞춤법 검사기를 이용한 파이썬용 한글 맞춤법 검사 라이브러리입니다.

파이썬 2.7 및 3.4 모두 호환됩니다.


설치

설치하는 방법으로는 두 가지 방법이 있습니다.

우선 pip를 이용해 설치하는 방법이 있습니다. 커맨드 라인에 다음 명령어를 입력하시면 자동으로 설치가 진행됩니다

$ pip install py-hanspell

다음으로 이 GitHub 저장소에서 직접 내려받아 설치하는 방법입니다. 이 저장소를 로컬에 clone 하거나 우측에 보이는 메뉴에서 zip 파일로 다운받은 후에 로컬 커맨드 라인에

$ python setup.py install

를 입력하시거나, 또는 hanspell 폴더를 자신의 프로젝트 폴더 안에 포함시키면 됩니다.

필요한 라이브러리

  • requests

사용 방법

>>> from hanspell import spell_checker
>>> result = spell_checker.check(u'안녕 하세요. 저는 한국인 입니다. 이문장은 한글로 작성됬습니다.')
>>> result.as_dict()  # dict로 출력
{'checked': '안녕하세요. 저는 한국인입니다. 이 문장은 한글로 작성됐습니다.',
 'errors': 4,
 'original': '안녕 하세요. 저는 한국인 입니다. 이문장은 한글로 작성됬습니다.',
 'result': True,
 'time': 0.07065701484680176,
 'words': {'안녕하세요.': 2,
           '저는': 0,
           '한국인입니다.': 2,
           '이': 2,
           '문장은': 2,
           '한글로': 0,
           '작성됐습니다.': 1}}
>>> result
Checked(result=True, original='안녕 하세요. 저는 한국인 입니다. 이문장은 한글로 작성됬습니다.', checked='안녕하세요. 저는 한국인입니다. 이 문장은 한글로 작성됐습니다.', errors=4, words=OrderedDict([('안녕하세요.', 2), ('저는', 0), ('한국인입니다.', 2), ('이', 2), ('문장은', 2), ('한글로', 0), ('작성됐습니다.', 1)]), time=0.10472893714904785)

list로 주고받기

>>> from hanspell import spell_checker
>>> spell_checker.check([u'안녕 하세요.', u'저는 한국인 입니다.'])
[Checked(result=True, original='안녕 하세요.', checked='안녕하세요.', errors=1, words=OrderedDict([('안녕하세요.', 2)]), time=0.03297615051269531),
 Checked(result=True, original='저는 한국인 입니다.', checked='저는 한국인입니다.', errors=1, words=OrderedDict([('저는', 0), ('한국인입니다.', 2)]), time=0.029018878936767578)]

Checked

attribute -
result 맞춤법 검사 성공여부를 나타냅니다.
original 검사 전의 문장입니다.
checked 맞춤법 검사 후의 문장입니다.
errors 맞춤법 오류 수를 나타냅니다.
words Checked.words
time 총 요청 시간을 나타냅니다.

Checked.words

위 사용 방법에 나와있는 words 부분은 교정된 최종 문장을 공백으로 나눈(split) 결과입니다.

결과는 key가 단어, value가 CheckResult를 나타냅니다.

아래 코드를 참고하세요.

>>> for key, value in result.words.items():
...    print(key, value)
안녕하세요. 2
저는 0
한국인입니다. 2
 2
문장은 2
한글로 0
작성됐습니다. 1

CheckResult

아래 코드로 import 하신 후 비교에 사용할 수 있는 상수입니다.

from hanspell.constants import CheckResult
.CONST -
.PASSED 맞춤법 검사 결과 문제가 없는 단어 또는 구절
.WRONG_SPELLING 맞춤법에 문제가 있는 단어 또는 구절
.WRONG_SPACING 띄어쓰기에 문제가 있는 단어 또는 구절
.AMBIGUOUS 표준어가 의심되는 단어 또는 구절
.STATISTICAL_CORRECTION 통계적 교정에 따른 단어 또는 구절

라이브러리 사용에 대한 안내

이 라이브러리는 네이버 한글 맞춤법 검사기를 바탕으로 만들어진 라이브러리입니다.

모든 결과 및 데이터에 대한 저작권 및 책임은 네이버 주식회사에 있으며, 라이브러리를 상업적으로 사용하거나 불법적인 용도로 활용한 부분에 대해서는 그 어떠한 부분에 대해서도 개발자는 책임지지 않습니다.

변경내역

  • 버전 1.1: list 타입으로 주고받는 기능 지원, 처리속도 향상
  • 버전 1.0: 첫 버전 릴리즈

라이선스(License)

py-hanspell은 MIT License로 제공됩니다. 라이선스 전문은 아래와 같습니다:

The MIT License (MIT)

Copyright (c) 2015 SuHun Han

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

py-hanspell's People

Contributors

byeongyuseob avatar dependabot[bot] avatar jungin500 avatar sinwoobang avatar ssut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

py-hanspell's Issues

py-hanspell spell_checker.check 사용 시 KeyError: 'result'

안녕하세요.

chec = spell_checker.check() 사용 시 KeyError: 'result'가 반환됩니다.
hanspell\spell_checker.py 내 line 62 에서
html = data['message']['result']['html']
부분 중 ['result'] 부분에서 keyerror가 발생한 것 같습니다.

hanspell 모듈 사용이 처음이라 어느 부분에서 문제가 발생한 것인지 알기 어려워 질문 드립니다.

파싱에러 관련

아래와 같이 에러가 발생했는데요, 혹시 사유를 알 수 있을까요?

Traceback (most recent call last):
File "C:/homin/prod_spellcheck.py", line 50, in
spell_check()
File "C:/homin/prod_spellcheck.py", line 33, in spell_check
result = spell_checker.check(unchktext)
File "C:\Users\KTds_User\AppData\Local\Programs\Python\Python38\lib\site-packages\py_hanspell-1.1-py3.8.egg\hanspell\spell_checker.py", line 39, in check
File "C:\Users\KTds_User\AppData\Local\Programs\Python\Python38\lib\site-packages\py_hanspell-1.1-py3.8.egg\hanspell\spell_checker.py", line 68, in check
File "C:\Users\KTds_User\AppData\Local\Programs\Python\Python38\lib\site-packages\py_hanspell-1.1-py3.8.egg\hanspell\spell_checker.py", line 27, in _remove_tags
File "C:\Users\KTds_User\AppData\Local\Programs\Python\Python38\lib\xml\etree\ElementTree.py", line 1320, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 1200

500자 이상도 검사할 수 있도록 개선.

네이버 맞춤법 검사기가 최대 500자까지 지원하는 관계로 500자 이상은 검사가 불가능함.
이를 개선하기 위해

안녕하세요. ... 저*는 한국인입니다.

에서 * 까지가 딱 500자일 때

안녕하세요. ...

저는 한국인입니다.

로 나누어서 여러 번 리퀘스트를 나누어서 처리한 후 다시 합치는 방법을 사용.

그 외: 쉼표(,)나 마침표(.)로 구분하는 방법.

sepell_checker 관련하여

언제 픽스될까요..? 급하게 사용해야하는데, 예상 완료 일정이 궁급합니다.
추가로는 대안이 있을까요? 당장 대안으로 사용 가능한 방법 알고 계신분 구체적으로 한번 도움 요청드립니다 ㅠㅠ

스펠체커 오류 픽스 예상 일정 관련

(수정)안녕하세요.
혹 result 관련 에러 픽스가 오래 걸릴 것으로 예상되는 작업일까요?
네이버 글자수도 500자에서 300자 제한으로 바뀌고 서버에 정보 변동이 있는 것인지..
중요한 작업을 앞두고 있는 터라 기다리다
마음이 급해 글을 남겨봅니다.
대략적인 픽스 일정이라도 알 수 있을까요?
수고에 깊이 감사드립니다.

KeyError: Result 에러에 대한 간단한 해결책 공유드립니다.

다른 분들이 남겨주신 Issue를 참고해서 단기적인 해결책을 찾았습니다.

spell_checker.py 파일에서 payload에 "passportKey"라는 키를 추가하고, 밸류는 네이버에서 맞춤법 검사기를 검색한 뒤 나오는 창에서 개발자도구를 연 뒤, ctrl + F를 이용해 passportKey를 찾아서 복사 붙여넣기 합니다. passportKey는 매일마다 다른 값으로 바뀌는 것 같으니 참고하세요.
payload의 수정 예시는 아래와 같습니다.

payload = { "passportKey": '4e41822344245ac366e86a871a21a5816ead030b', 'color_blindness': '0', 'q': text }

result error 해결 방법 2가지 모두 사용했는데 계속 오류가 생깁니다.

colab에서 코드를 돌리고 있습니다.

첫번째 해결 방법인 passportKey, _callback 키를 가져와서 입력해봤습니다.

(주기적으로 키 번호가 바뀌는 것을 인지하고 있습니다)
payload = {
'passportKey' : 'c5f8a67b9f85b45009b57c9ede6ee783b3e9f0cf',
'_callback' : 'jQuery112409013021542316217_1708686518553',
'q': text,
'color_blindness': '0',
}

두번째 해결 방법인 data를 바꿨습니다.

import re

json_data = re.search(r'((.*))', r.text).group(1)
data = json.loads(json_data)

이렇게 두가지 모두 수정해서 실행 했는데 계속 result 오류가 발생합니다. 너무 화납니다.
저랑 같은 상황이신 분 계신가요?

한스펠 기본 사전

한스펠에서 맞춤법이나 띄어쓰기 교정을 위해 기본적으로 사용하는 표준어 사전 같은게 있는지, 있다면 다운 가능한지 궁금합니다... 감사합니다.

hanspell 단점

Hanspell 라이브러리 의 최대 단점 : 결국 request 를 이용한 네이버 맞춤법 검사기 API를 사용하는 것이어서 네이버 검사기 특성에 따라 500자 이상은안되고
Hanspell 라이브러리의 자체적 기능이라고 보기 어렵고 네이버 사이트에 의존적이므로 네이버 사이트에서 제공하는 맞춤법 검사기가 회사 사정으로 서비스가 문제가 생기면 Hanspell은 무용지물이 됨. 또한 회사에 따라 사내망이나 폐쇄망을 사용하는 환경이나 오프라인 환경에서는 라이브러리 구동이 되지 않거나 SSL 오류가 생겨 verify 해결법을 강구해야 해서 사실상 사용 제약이 심하고 자율성이 떨어짐 symspell 같은 독립적 구동이 가능한 대안 라이브러리가 필요한데 symspell도 퀄리티가 높지 않고 그외에는 대안이 없다는게 함정

py-hanspell 사용 관련

py-hanspell의 spell-checker.py 부분에서

result = spell_checker.check() line에서

변수 r을 print해보면

<Response [403]>이 계속 뜨는데요,

즉, data = json.loads(r) 부분에서 계속 에러가 뜹니다.

혹시 현재 spell-checker가 사용이 불가능한지, 아니면 제 코드상에 오류인지 확인하고 싶습니다.

KeyError: Result 에러 해결 방법을 좀 더 간편하게 수정해 보았습니다.

초기에는 issue #47 해결방법을 적용하신 뒤 이후 매일 변경되는 passportKey에 대해서 아래와 같이 코드를 사용하면 번거롭게 매번 passportKey를 수동으로 변경하지 않으셔도 될 것 같아 공유드립니다.

현 시점에서는 잘 작동하지만 html에서 passportKey가 더이상 노출되지 않게 된다면 작동하지 않을 것입니다.

import re
import requests

def get_passport_key():
    """네이버에서 '네이버 맞춤법 검사기' 페이지에서 passportKey를 획득

        - 네이버에서 '네이버 맞춤법 검사기'를 띄운 후 
        html에서 passportKey를 검색하면 값을 찾을 수 있다.

        - 찾은 값을 spell_checker.py 48 line에 적용한다.
    """

    url = "https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=네이버+맞춤법+검사기"
    res = requests.get(url)

    html_text = res.text

    match = re.search(r'passportKey=([^&"}]+)', html_text)
    if match:
        passport_key = match.group(1)
        return passport_key
    else:
        return False


def fix_spell_checker_py_code(file_path, passportKey):
    """획득한 passportkey를 spell_checker.py파일에 적용
    """
    
    pattern = r"'passportKey': '.*'"

    with open(file_path, 'r', encoding='utf-8') as input_file:
        content = input_file.read()
        modified_content = re.sub(pattern, f"'passportKey': '{passportKey}'", content)

    with open(file_path, 'w', encoding='utf-8') as output_file:
        output_file.write(modified_content)
    
    return 


# before run
spell_checker_file_path = './hanspell/spell_checker.py'

passport_key = get_passport_key()
if passport_key:
    fix_spell_checker_py_code(spell_checker_file_path, passport_key)
else:
    print("passportKey를 찾을 수 없습니다.")

spell_checker.check()을 하기 전에 필요한 전처리가 무엇인가요?

x = ' 관심 0&※ 간섭 있습니다'
 spell_checker.check(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kwhkim/opt/miniconda3/envs/py38spacing/lib/python3.8/site-packages/hanspell/spell_checker.py", line 68, in check
    'checked': _remove_tags(html),
  File "/Users/kwhkim/opt/miniconda3/envs/py38spacing/lib/python3.8/site-packages/hanspell/spell_checker.py", line 27, in _remove_tags
    result = ''.join(ET.fromstring(text).itertext())
  File "/Users/kwhkim/opt/miniconda3/envs/py38spacing/lib/python3.8/xml/etree/ElementTree.py", line 1320, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 15

문제는 &인 것 같은데, 문자열에 사용할 수 없는 문자가 있나요?

[BUG] pip install

'requirements.txt' 파일이 누락되었습니다.

$ pip install py-hanspell
Collecting py-hanspell
  Downloading py-hanspell-1.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-dc416kan/py-hanspell/setup.py", line 40, in <module>
        install()
      File "/tmp/pip-build-dc416kan/py-hanspell/setup.py", line 7, in install
        with open('requirements.txt') as f:
    FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dc416kan/py-hanspell/

error개수 잘못 카운트

안녕하세요.
사용하던 중에 입력 발화로 ㅋㅋㅋㅋㅋㅋ 야 하이를 입력하니까

{'checked': 'ㅋㅋㅋㅋㅋㅋ 야 하이',
 'errors': 1,
 'original': 'ㅋㅋㅋㅋㅋㅋ 야 하이',
 'result': True,
 'time': 0.036745548248291016,
 'words': OrderedDict([('<span', 0),
                       ("class='violet_text'>ㅋㅋㅋㅋㅋㅋ", 0),
                       ('야', 0),
                       ('하이', 0)])}

이와 같은 결과가 나왔습니다. 현재 words안에 모든 단어가 0으로 에러가 없다고 나오는데 errors의 값이 1로 잘못표기 됩니다.

제 생각에는 <spanclass='violet_text'>으로 인해 error가 발생하는 것으로 보입니다.

KeyError

KeyError Traceback (most recent call last)
in <cell line: 4>()
2
3 sent = "맞춤법 틀리면 외 않되? "
----> 4 spelled_sent = spell_checker.check(sent)
5
6 hanspell_sent = spelled_sent.checked

/usr/local/lib/python3.10/dist-packages/hanspell/spell_checker.py in check(text)
60
61 data = json.loads(r.text)
---> 62 html = data['message']['result']['html']
63 result = {
64 'result': True,

KeyError: 'result'

위의 에러가 뜨는데 혹시 어떻게 해애할까요..?

data = json.loads(r) 오류 관련

설치 전 setup.py 파일 내용이 원본과 같은지 확인한 뒤 설치해보세요. 제가 잘못 넣은건지 data = json.loads(r) 윗 라인에 g 라는 문자가 끼어있어서 오류가 났습니다.

py-hanspell 사용 관련 #7@lepus2 님이 올려주신 내용 대로 변경하면 정상 작동합니다.

py-hanspell json.loads(r)

예시로 들어주신 result = spell_checker.check(u'안녕 하세요. 저는 한국인 입니다. 이문장은 한글로 작성됬습니다.') 에서

spell_checker.py 의 data = json.loads(r) 에 오류가 발생합니다.

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 이란 오류가 뜨고 제 생각엔 decoding part에서 오류가 발생했다고 여겨지는데 해결할 수 있는 방법이 있나요?

python version이 3.6.5 라서 그런건지 아니면 request의 version이 상위여서 그런지 궁금합니다.

JSONDecodeError: Expecting value: line 1 column 1 (char 0) 에러 발생

안녕하세요. 기존에 hanspell 을 이용하여 리뷰 데이터 분석을 진행한 경험이 있었는데요,
동일한 코딩으로 최근에 다시 진행을 해보려고 하니 위 제목과 같은 에러가 발생합니다.

xlsx 리뷰 텍스트 파일을 불러온 후 1) 공백제거 2) spacing 3) hanspell 맞춤법 검사 적용의 방식으로 기존에도 동일하게 진행했었는데
나름대로 여러 시도를 해보아도 계속 동일하게 아래와 같은 에러 메세지가 출력됩니다.
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

  • 설치는 이상없이 진행하였는데 정상 작동 여부를 위해 아래 구문을 입력해보아도 같은 문제가 발생합니다.

from hanspell import spell_checker
result = spell_checker.check('안녕 하세요. 저는 한국인 입니다. 이문장은 한글로 작성됬습니다.')
result.as_dict()

관련하여 답변 주실 수 있는 분 계시면 도움 부탁 드립니다 :)

JSONDecodeError: Expecting value; line1 column 1(char0) 오류

안녕하세요. 기존에 hanspell을 사용하여 프로젝트를 하고 있는 컴퓨터공학과 학생입니다.

다름이 아니라, 며칠 전까지만 해도 오류 없이 잘 실행되던 코드가 제목과 같이 오류가 생성되어 이렇게 issue를 남기게 되었습니다.

혹시 몰라, try-except 예외처리를 해줬는데, 오류 없이 실행은 되긴 하지만, 맞춤법이 수정되지 않고, 공백만 출력되었습니다.

관련하여, solution 주실 수 있으신 분 계시면 감사하겠습니다.

SSLError 발생

Python error :
SSLError: HTTPSConnectionPool(host='m.search.naver.com', port=443): Max retries exceeded with url: /p/csearch/ocontent/spellchecker.nhn?_callback=window.__jindo2_callback._spellingCheck_0&q=%EB%A7%9E%EC%B6%A4%EB%B2%95+%ED%8B%80%EB%A6%AC%EB%A9%B4+%EC%99%B8+%EC%95%8A%EB%90%98%3F+%EC%93%B0%EA%B3%A0%EC%8B%B6%EC%9D%80%EB%8C%80%EB%A1%9C%EC%93%B0%EB%A9%B4%EB%8F%BC%EC%A7%80+ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)')))

https://m.search.naver.com/p/csearch/ocontent/spellchecker.nhn 접속에러

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /spellchecker.nhn.

Reason: Error reading from remote server

python 3.9 / request 2.26.0 버전 사용가능 확인 완료

안녕하세요. python 3.9 버전에서 사용 가능함을 확인하였습니다.
requests version 2.26.0 을 사용하였습니다.
하위호환 때문에 섣불리 description 과 setup.py 를 변경하지 않았습니다.
반영해주시면 감사하겠습니다.

ParseError

Traceback (most recent call last):
File "main.py", line 47, in
df = process_data(df)
File "main.py", line 19, in process_data
processed_reviews = process_reviews(cleaned_reviews)
File "/Users/bbq12340/dev/sentimentAnalysis/process.py", line 25, in process_reviews
review = spell_checker.check(review).as_dict()['checked']
File "/Users/bbq12340/dev/sentimentAnalysis/env/lib/python3.8/site-packages/hanspell/spell_checker.py", line 68, in check
'checked': _remove_tags(html),
File "/Users/bbq12340/dev/sentimentAnalysis/env/lib/python3.8/site-packages/hanspell/spell_checker.py", line 27, in _remove_tags
result = ''.join(ET.fromstring(text).itertext())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xml/etree/ElementTree.py", line 1320, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 226

파싱하는 과정에서 에러가 발생하였습니다. 에러 발생을 방지해야 할 것 같습니다.

[이슈 문의] KeyError: 'result'

안녕하세요. 현재 파이썬 버전 3.10.10을 사용하고 있으며 README.md에서 제공한 예제를 돌려본 결과 아래의 에러가 발생합니다.

Traceback (most recent call last):
  File "c:\~\spell.py", line 3, in <module>
    result = spell_checker.check(u'안녕 하세요. 저는 한국인 입니다. 이문장은 한글로 작성됬습니다.')
  File "c:\~\lib\hanspell\spell_checker.py", line 62, in check
    html = data['message']['result']['html']
KeyError: 'result'

해당 문제에 대해 제가 놓치고 있는 부분이 있는지 알고 싶습니다.

spell_checker 적용하신분중 정상작동하시나요

잘작동했었는데 지금 정상 작동을 안하고있습니다. 네이버에서 지원을 안해주는건지 궁금하기는한데요 다른분들은 잘작동하시나요?

data = json.loads(r) 부분이 에러나는데

데이터를 못가져오는거같아서요.

오늘 새로운 passportKey 라는 파라미터가 추가되면서 동작하지 않는것 같습니다.

image

오늘 갑자기 맞춤법 검사가 안되서 확인해보니 passportKey라는게 추가되었습니다. 이거 값이 계속해서 바뀌는거면 더이상 라이브러리가 사용이 어려울수도 있을것 같아요 일단 몇시간 지켜봤는데 고정되어있긴합니다. 그런데 시간단위일지, 아니면 일단위 일지 모르겠지만 저 값이 빠지거나 내부적으로 변경되면 사용못할것 같아요 어떻게 해결해 볼 수 있을까요?

URL 예시

https://m.search.naver.com/p/csearch/ocontent/util/SpellerProxy?passportKey=553f46b15389bd8738bc4bcdce6fc217766831c7&_callback=jQuery112408824280372691444_1695341199690&q=%EC%95%88%EB%85%95%ED%95%98%EC%84%B8%EC%98%81&where=nexearch&color_blindness=0&_=1695341199696

pip.req 에러

설치시에 pip.req라는 모듈이 없어서 오류가 난다고 합니다.

스텍오버플로에서 임시적인 해결법을 찾았지만 혹시 조금 더 근원적인 해결이 가능한지 알고싶습니다.

멋진 코드에 감사드립니다.

패키지 설치 오류

Collecting py-hanspell
Using cached py-hanspell-1.1.tar.gz (3.0 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/tmp/pip-install-np815kcr/py-hanspell_6bee0fb3c65e460b97f9b638d6b57545/setup.py", line 2, in
from pip.req import parse_requirements
ModuleNotFoundError: No module named 'pip.req'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

라는 오류는 왜 뜨는 걸까요?

KeyError: 'result'

얼마만에 다시 이용해 보니 아래와 같은 오류가 발생합니다.

Traceback (most recent call last):
File "", line 1, in
File "/Users/username/opt/miniconda3/lib/python3.9/site-packages/hanspell/spell_checker.py", line 62, in check
html = data['message']['result']['html']
KeyError: 'result'

혹시 뭐가 문제인지 알 수 있을까요?

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

안녕하세요.
자연어 처리 관련하여 spell checker 연구를 진행 중인 학생입니다.
JSONDecodeError: Expecting value: line 1 column 1 (char 0) 이슈로 인해 #32 문제를 확인하고 Base_URL 수정하여 진행 중 아래와 같은 문제 사항이 발생되고 있습니다.

문제 사항

  1. 맞춤법이 틀린 문장을 넣었을 때 동일한 이슈가 발생되고 있습니다. (반대로, 맞춤법이 올바른 문장을 넣을 시 변수에 담긴 문장 그대로를 출력하고 있습니다.)

혹시 알려주실 분 계실까요..? (최근 이슈 #32, #31은 확인 하였습니다.)

엔터도 됬으면 좋겠어요.

'안녕하세요. \n 안녕하세요. \n 안녕하세요. ' 이렇게 맟춘법검사 해서 출력하면 한줄도 됨니다.
엔터도 되게 해주세요.

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.