-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.Rhistory
74 lines (74 loc) · 2.16 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
library(text2vec)
library(tm)
toy_data_train <- c('Cats like to chase mice.',
'Dogs like to eat big bones.')
txt <- removePunctuation(toy_data_train)
it <- itoken(txt, tolower, word_tokenizer, n_chunks=10)
vocab <- create_vocabulary(it)
vocab
vectorizer <- vocab_vectorizer(vocab)
tcm <- create_tcm(it,vectorizer,skip_grams_window=2L)
tcm
tcm <- create_tcm(it, vectorizer, skip_grams_window = 2)
tcm
tcm <- create_tcm(it, vectorizer, skip_grams_window = 3)
tcm
tcm <- create_tcm(it, vectorizer, skip_grams_window = 2)
tcm
tcm <- create_tcm(it, vectorizer, skip_grams_window = 3)
tcm
toy_data_train <- c('Cats like to chase mice.',
'Dogs like to eat big bones.',
'Cats like to play.')
txt <- removePunctuation(toy_data_train)
it <- itoken(txt, tolower, word_tokenizer, n_chunks = 10)
vocab <- create_vocabulary(it)
vocab
vectorizer <- vocab_vectorizer(vocab)
tcm <- create_tcm(it, vectorizer, skip_grams_window = 3)
tcm
tcm <- create_tcm(it, vectorizer, skip_grams_window = 1)
tcm
tcm <- create_tcm(it, vectorizer, skip_grams_window = 2)
tcm
tcm <- create_tcm(it, vectorizer, skip_grams_window = 2)
tcm
toy_data_train <- c('Cats like to chase mice.',
'Dogs like to eat big bones.')
txt <- removePunctuation(toy_data_train)
it <- itoken(txt, tolower, word_tokenizer, n_chunks = 10)
vocab <- create_vocabulary(it)
vocab
vectorizer <- vocab_vectorizer(vocab)
tcm <- create_tcm(it, vectorizer, skip_grams_window = 3)
tcm
tcm@x
max(tcm@x)
argmax(tcm@x)
max(tcm@x)
length(tcm@x)
tcm@x[tcm@x==2]
which.max(tcm@x)
which.max(tcm@x[,2])
tcm@x
tcm@Dim
tcm@Dimnames
which.max(tcm)
tcm@factors
# what is tcm?
library(text2vec)
library(tm)
toy_data_train <- c('Cats like to chase mice.',
'Dogs like to eat big bones.')
txt <- removePunctuation(toy_data_train)
it <- itoken(txt, tolower, word_tokenizer, n_chunks = 10)
vocab <- create_vocabulary(it)
vocab
vectorizer <- vocab_vectorizer(vocab)
tcm <- create_tcm(it, vectorizer, skip_grams_window = 3)
tcm
vectorizer <- vocab_vectorizer(vocab)
tcm <- create_tcm(it, vectorizer, skip_grams_window = 2)
tcm
tcm <- create_tcm(it, vectorizer, skip_grams_window = 3)
tcm