반응형

가상환경에  https://github.com/lovit/customized_konlpy  들어가서 내려받은 후에 잘 적용시켜야 한다. 

 

https://inspiringpeople.github.io/data%20analysis/ckonlpy/ 에서는 이미 가상환경을 잘 알고 있다는 가정하에 작성된거 같다.

 

1. 대상 폴더에 내려받고

2. python 가상환경 들어간 후에  "  activate main " 

   - 나는  main 이라는 가상환경을 따로 만들었다.

3. 내려받은 파일의  setup.py를 실행. 

4. python 실행 시킨후 예제 구문 실행해보면 되는 것을 확인 할 수 있다.

  - 2022-07-04 다시 확인해봤는데 잘 된다. 

 

한국어 자연어처리를 할 수 있는 파이썬 패키지, KoNLPy의 customized version입니다.

customized_KoNLPy는 확실히 알고 있는 단어들에 대해서는 라이브러리를 거치지 않고 주어진 어절을 아는 단어들로 토크나이징 / 품사판별을 하는 기능을 제공합니다. 이를 위해 template 기반 토크나이징을 수행합니다.

사전: {'아이오아이': 'Noun', '는': 'Josa'}
탬플릿: Noun + Josa

위와 같은 단어 리스트와 탬플릿이 있다면 '아이오아이는' 이라는 어절은 [('아이오아이', 'Noun'), ('는', 'Josa')]로 분리됩니다.

Install

$ git clone https://github.com/lovit/customized_konlpy.git

$ pip install customized_konlpy

Requires

  • JPype >= 0.6.1
  • KoNLPy >= 0.4.4

 

반응형
반응형

[Python] In dictionary, converting the value from string to integer. 

Dict에서 value가 숫자형이 아닐때 숫자로 변경

Taking this below example :

'user_stats': {'Blog': '1',
                'Discussions': '2',
                'Followers': '21',
                'Following': '21',
                'Reading': '5'},

I want to convert it into:

'Blog' : 1 , 'Discussion': 2, 'Followers': 21, 'Following': 21, 'Reading': 5

 

>>> d = {'Blog': '1', 'Discussions': '2', 'Followers': '21', 'Following': '21', 'Reading': '5'}
>>> dict((k, int(v)) for k, v in d.iteritems())
{'Blog': 1, 'Discussions': 2, 'Followers': 21, 'Following': 21, 'Reading': 5}

 

https://stackoverflow.com/questions/9224385/in-dictionary-converting-the-value-from-string-to-integer

 

In dictionary, converting the value from string to integer

Taking this below example : 'user_stats': {'Blog': '1', 'Discussions': '2', 'Followers': '21', 'Following': '21', 'Reading': '5'}, ...

stackoverflow.com

 

반응형

+ Recent posts