사전 훈련된 단어 임베딩을 fastTextWordEmbedding을 사용하여 불러옵니다. 이 함수를 사용하려면 Text Analytics Toolbox™ Model for fastText English 16 Billion Token Word Embedding 지원 패키지가 필요합니다. 이 지원 패키지가 설치되어 있지 않으면 함수에서 다운로드 링크를 제공합니다.
emb = fastTextWordEmbedding
emb =
wordEmbedding with properties:
Dimension: 300
Vocabulary: [1×1000000 string]
word2vec을 사용하여 단어 "Italy", "Rome" 및 "Paris"를 벡터에 매핑합니다.
italy = word2vec(emb,"Italy");
rome = word2vec(emb,"Rome");
paris = word2vec(emb,"Paris");
vec2word를 사용하여 벡터 italy - rome + paris를 단어에 매핑합니다.
사전 훈련된 단어 임베딩을 fastTextWordEmbedding을 사용하여 불러옵니다. 이 함수를 사용하려면 Text Analytics Toolbox™ Model for fastText English 16 Billion Token Word Embedding 지원 패키지가 필요합니다. 이 지원 패키지가 설치되어 있지 않으면 함수에서 다운로드 링크를 제공합니다.
emb = fastTextWordEmbedding;
word2vec을 사용하여 단어 "Italy", "Rome" 및 "Paris"를 벡터에 매핑합니다.
italy = word2vec(emb,"Italy");
rome = word2vec(emb,"Rome");
paris = word2vec(emb,"Paris");
vec2word를 사용하여 벡터 italy - rome + paris를 단어에 매핑합니다. 유클리드 거리 측정법을 사용하여 가장 가까운 상위 5개 단어를 찾습니다.
k = 5;
M = italy - rome + paris;
[words,dist] = vec2word(emb,M,k,'Distance','euclidean');
단어와 거리를 막대 차트에 플로팅합니다.
figure;
bar(dist)
xticklabels(words)
xlabel("Word")
ylabel("Distance")
title("Distances to Vector")
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.