index2: Index

Description Usage Arguments Examples

Description

Return the index of the work in the vectors.

Usage

1
2
3
4
5
6
7
index(model, word)

## S3 method for class 'wordvectors'
index(model, word)

## S3 method for class 'wordclusters'
index(model, word)

Arguments

model

A model as returned by word_vectors or word_clusters.

word

The word to extract.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
# setup word2vec Julia dependency
setup_word2vec()

# sample corpus
data("macbeth", package = "word2vec.r")

# train model
model_path <- word2vec(macbeth)

# get word vectors
model <- word_vectors(model_path)

# cindex of macbeth
index(model, "macbeth")

## End(Not run)

news-r/word2vec.r documentation built on Nov. 4, 2019, 9:41 p.m.