인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

gbdndl2343's profile image
gbdndl2343

asked

[NLP] Python text analysis and natural language processing through IMDB movie review sentiment analysis

[3/4] Vectorizing Text Data with CountVectorizer

질문드립니다.

Written on

·

179

1

텍스트 벡터화 부분에서 

 

for tag, count in zip(vocab, dist):
    print(count, tag)

위 부분은 어떤 역할을 하는지 이해가 어렵습니다.
설명 부탁드리겠습니다.
감사합니다.

NLPpython

Answer 1

1

todaycode님의 프로필 이미지
todaycode
Instructor

안녕하세요.

vocab 이라는 변수에는 벡터화 한 단어들의 사전이 들어있으며,

dist 라는 변수에는 빈도수가 들어있습니다.

그런데 이 두가지 값이 개별 벡터로 되어 있으니 zip을 통해 key-value 형태로 묶어주는 과정입니다.

그래서 어떤 단어가 얼마나 빈도수가 있는지 확인하는 코드입니다.

 

gbdndl2343's profile image
gbdndl2343

asked

Ask a question