python)영어 문장에서 명사 판별하는 좋은 방법이 뭘까요?
조회수 1061회
파이썬을 사용하고 있습니다. 바로 질문 드릴게요!
text = '''Manchester City won the Under-18 Premier League Cup for a second successive season after beating Stoke City 6-0 at Academy Stadium.
Stoke had knocked out 2017/18 winners Chelsea to reach the final for the first time but went behind to Samuel Edozie's deflected 39th-minute opener.
Man City then hit five goals in 15 second-half minutes.
Liam Delap netted a stunning solo goal before James Mcatee and captain Cole Palmer, pictured above lifting the Trophy, both struck braces.'''
위에 있는 text 변수에는 영문이 저장 되어 있습니다. text 변수에서 명사만 잡아내고 싶습니다. 그래서 명사 데이터를 영문사전에서 크롤하여 데이터베이스에 크롤하고 있는데, 이런 방법 말고 손쉽게 명사 정보를 담고 있는 api나 파이썬 라이브러리 같은 게 있을까요?
test = 위와같은 영어문장 초기화
eng_list = test.split(" ")
for word in eng_list:
if word == 명사:
print("이 단어는 명사입니다.")
간단하게 이런 식으로라도 명사인지 아닌지 판별할 수 있을까요?
3 답변
-
안해봤으니 확신은 없지만
품사를 특정할 수 있다는 걸 봐서는 가능할 듯 싶네요.
-
형태소 분석을 해야합니다.
파이썬에 영문 형태소 분석 모듈로 nltk 를 많이 사용합니다.
한글이라면 konlpy 를 많이 사용하고 실제 형태소 분석 엔진은 다양하게 사용합니다.
아래 문서보고 하나씩 따라해보세요.
https://datascienceschool.net/view-notebook/8895b16a141749a9bb381007d52721c1/
-
사전에서 제공하는 API를 이용하면 어떨까요?
댓글 입력