강의

멘토링

커뮤니티

인프런 커뮤니티 질문&답변

Ki-Sung Kim님의 프로필 이미지
Ki-Sung Kim

작성한 질문수

[NLP] IMDB 영화리뷰 감정 분석을 통한 파이썬 텍스트 분석과 자연어 처리

[2/4] NLP 텍스트 데이터 전처리

br태그 정제

작성

·

183

0

from bs4 import BeautifulSoup

 

example1 = BeautifulSoup(train['review'][0], "html5lib")

print(train['review'][0][:700])

example1.get_text()[:700]

이 코드를 실행하려고 하는데 

 

File "<pyshell#69>", line 1, in <module>

    example1 = BeautifulSoup(train['review'][0], "html5lib")

  File "C:\Users\Ki-Sung Kim\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bs4\__init__.py", line 208, in __init__

    % ",".join(features))

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?

 

이런식으로 에러가 납니다. 어떻게 해결 해야 하나요...

답변 1

0

박조은님의 프로필 이미지
박조은
지식공유자

parser library에서 html5lib를 찾지 못하는 문제인데 cmd 등을 통해 install을 진행해도 인식하지 못하는 경우가 있습니다.

이 경우에는 pip install lxml을 진행하시고

example1 = BeautifulSoup(train['review'][0], lxml)
print(train['review'][0][:700])
example1.get_text()[:700]

을 진행하시면 되겠습니다.

Ki-Sung Kim님의 프로필 이미지
Ki-Sung Kim

작성한 질문수

질문하기