최신 자연어 처리 모델에서 가장 많이 사용되는 문서 벡터 표현을 나열해보겠다. 첫 두 가지는
단어 빈도
term
frequency
와 단어 빈도-역문서 빈도
term
frequency
-
inverse
document
frequency
(
TF
-
IDF
)로,
빈도 기반의 통계적 표현이다. 이 방법은 특정 단어의 존재 여부를 감지하는 간단한 이진 표현
보다는 약간 더 복잡하지만 단순히 단어를 세는 수준에 불과하다. 그럼에도 불구하고 이 방법
을 통한 표현은 스팸 필터링 및 감성 분석과 같은 애플리케이션에 매우 유용하다.
7.5.1
Bag
of
Words
의 단어 빈도 벡터 표현
여기서는 단어의 순서를 무시하고 문서의
Bag
of
Words
를 사용하여 문서를 나타낸다. 단어
의 순서는 문서의 중요한 정보를 인코딩하지만 짧은 문장과 구문에 대해서는 일반적으로 이를
무시해도 괜찮다.
주어진 문서를
10
,
000
개의 토큰으로 구성된 어휘 공간에 임베딩한다고 가정해보자. 그러면 이
문서를 나타내는 벡터는
10
,
000
개의 원소를 가지게 되며 각 원소는 문서에서 특정 토큰이 나
타나는 횟수를 의미한다. 따라서 우리는 이 방법을 문서의 단어 빈도 또는
Bag
of
Words
벡
터 표현이라고 하며 각 원소는 음이 아닌 정수가 된다.
예를 들어 ‘내일 날씨 어때?’라는 구글 검색 쿼리는 어휘에 ‘내일’, ‘날씨’, ‘어때’에 해당하는 단
어 토큰이 있으면 모두
1
씩 늘리고, 이에 해당하지 않는 토큰을
0
으로 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.