forked from computationalstylistics/stylo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
installwithoutgui.R
74 lines (68 loc) · 2.37 KB
/
installwithoutgui.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
print("R Script to install/start stylo Ancient History Edition.")
#set working directory to source file directory, only rstudio
print("Build directory for stylo AH:")
thewd <- getwd()
theinstdir <- dirname(thewd)
setwd( theinstdir )
print( theinstdir )
#DEPENDENCIES
print("Check for / install dependancies:")
if (!require( "lazyeval", character.only = TRUE)) {
install.packages("lazyeval", dependencies = TRUE)
}
if (!require( "rappdirs", character.only = TRUE)) {
install.packages("rappdirs", dependencies = TRUE)
}
if (!require( "pamr", character.only = TRUE)) {
install.packages("pamr", dependencies = TRUE)
}
if (!require( "e1071", character.only = TRUE)) {
install.packages("e1071", dependencies = TRUE)
}
if (!require( "readr", character.only = TRUE)) {
install.packages("readr", dependencies = TRUE)
}
if (!require( "tsne", character.only = TRUE)) {
install.packages("tsne", dependencies = TRUE)
}
if (!require( "reticulate", character.only = TRUE)) {
install.packages("reticulate", dependencies = TRUE)
}
if (!require( "ape", character.only = TRUE)) {
install.packages("ape", dependencies = TRUE)
}
if (!require( "networkD3", character.only = TRUE)) {
install.packages("networkD3", dependencies = TRUE)
}
if (!require( "parallel", character.only = TRUE)) {
install.packages("parallel", dependencies = TRUE)
}
if (!require( "transport", character.only = TRUE)) {
install.packages("transport", dependencies = TRUE)
}
if (!require( "statip", character.only = TRUE)) {
install.packages("statip", dependencies = TRUE)
}
print("Build and install stylo AH:")
file.rename("styloAH-master", "styloAH") #just in case
system("R CMD build styloAH") #build downloaded version
install.packages("styloAH_0.7.4.9.tar.gz", repos = NULL)
print("Working directory for stylo AH:")
newwd <- paste( theinstdir, "/styloAH", sep="")
print( newwd )
setwd( newwd )
print("Libraries / source python libraries:")
library(reticulate)
source_python("textnorm.py")
source_python("textdecomp.py")
library(parallel)
library(transport)
library(statip)
library(styloAH)
print("Run stylo:")
#set working dir to sample directory (containing corpus directory AND stylo_config.txt) dir
################################################ dont use styloAH folder
PATHTO = "/path/to/folder/with/corpus/folder/in/it/"
setwd( PATHTO )
print( getwd() )
stylo(gui=FALSE)