서식화된 텍스트에 대한 감성 분석
이 연습 문제에서는 call_2.wav의 고객 채널에 대해 감성을 계산해 보겠습니다(file).
이미 고객 채널을 분리해 call_2_channel_2.wav로 저장해 두었어요(file).
하지만 감성 분석은 문장마다 달라질 수 있다는 것을 알고 계시죠.
문장 단위로 계산하려면, NLTK의 sent_tokenize() 모듈을 사용해 텍스트를 문장별로 나눕니다.
다만 transcribe_audio()는 문장 단위로 반환하지 않습니다. 문장 단위 감성 분석을 시험해 보기 위해, 유료 API 서비스를 사용해 문장을 포함한 call_2_channel_2_paid_api_text를 얻어 두었습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 음성 언어 처리
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
from nltk.sentiment.vader import SentimentIntensityAnalyzer
# Create SentimentIntensityAnalyzer instance
sid = SentimentIntensityAnalyzer()
# Transcribe customer channel of call 2
call_2_channel_2_text = transcribe_audio(____)
# Display text and sentiment polarity scores
print(call_2_channel_2_text)
print(sid.____(call_2_channel_2_text))