-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.R
54 lines (44 loc) · 1.35 KB
/
run.R
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
processcsv <- function() {
di <- text.read.dict()
n1 <- text.read.ngram(1)
n2 <- text.read.ngram(2)
n3 <- text.read.ngram(3)
n4 <- text.read.ngram(4)
# TOTAL <- sum(n1$count)
saveRDS(di, 'data/di.rds')
saveRDS(n1, 'data/n1.rds')
saveRDS(n2, 'data/n2.rds')
saveRDS(n3, 'data/n3.rds')
saveRDS(n4, 'data/n4.rds')
}
footprint <- function (units="Kb") {
cat('DI', '\t', format(object.size(di), units=units), '\n')
cat('N1', '\t', format(object.size(n1), units=units), '\n')
cat('N2', '\t', format(object.size(n2), units=units), '\n')
cat('N3', '\t', format(object.size(n3), units=units), '\n')
cat('N4', '\t', format(object.size(n4), units=units), '\n')
}
# di <- readRDS('data/di.rds')
# n1 <- readRDS('data/n1.rds')
# n2 <- readRDS('data/n2.rds')
# n3 <- readRDS('data/n3.rds')
# n4 <- readRDS('data/n4.rds')
# text.guessoword(c(1,6,20),n1,n2,n3,n4)
# text.guessword(c(1,6),n1,n2,n3,n4)
# text.predict('how are you')
# text.predict('how is she')
#testsmall <- testset[sample(nrow(testset), 100),]
# benchmark(text.predict,
# sent.list = list('quizzes'=quizzes,'tweets'=tweets,'blogs'=blogs),
# ext.output=T )
#tmp <- timeit({ test.accuracy(testset, simpsons.predict) })
#summary(tmp)
#plot(tmp)
#mean(tmp)
# 100 en 27 seg.
# some tricks in R.
f <- function(i) {
r <- sample.int(3)[1] + m
m <<- r
r
}