Skip to content

[수정 제안] NounScore의 frequency와 score가 바뀌는 에러 #159

Description

@geabal

문제 설명

LRNounExtractor_v2를 사용할 때 score가 1을 초과하는 케이스를 발견했습니다.
predict() 메소드와 튜토리얼 글에서 미루어볼 때, score가 1을 초과하는 현상은 의도된 동작 결과가 아닌 것 같았습니다.

# score가 1을 초과하는 케이스
('지역혁신', NounScore(frequency=1.0, score=2))

코드를 살펴보니 soynlp/noun/_noun_ver2.py의 extract_compunds()에서 compund_counts 값과 score가 순서가 바뀌어 입력되고 있었습니다.

환경

  • python 3.11.14
  • soynlp 0.0.493
  • OS: Windows

수정 제안

  • _noun_ver2.py의 extract_compunds() : compunds 변수 assign 코드(line 519~520) 수정
# 수정 전
compounds = {noun:(score, compounds_counts.get(noun,0))
             for noun, score in compounds_scores.items()}
# 수정 후
compounds = {noun:(compounds_counts.get(noun,0), score)
             for noun, score in compounds_scores.items()}

참고

에러를 발견한 테스트 케이스(test.txt)와 에러 테스트 및 수정 코드(error_test.ipynb)를 첨부합니다.
https://drive.google.com/drive/folders/1Vz_tdu5KVwtKJ9qxMLFDF4lKEOMIoCEX?usp=sharing

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions