-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathserver.R
More file actions
27 lines (19 loc) · 696 Bytes
/
server.R
File metadata and controls
27 lines (19 loc) · 696 Bytes
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
library(shiny)
library(RWeka)
library(data.table)
options(shiny.maxRequestSize=64*1024^2)
load("nGramsLite.RData")
source("ngramPredictionFunction.R")
# Define server logic required to generate and plot a random distribution
shinyServer(function(input, output, session) {
observe({
t1 <- Sys.time()
input$phrase
out2 <- ngramPredictionFunction(input$phrase, ngram1, ngram2, ngram3, ngram4)
words <- as.data.frame(out2)[,1]
t2 <- Sys.time()
output$table <- renderTable({ data.frame(out2[,1, with=FALSE]) })
output$time <-renderPrint({ print(t2-t1) })
session$sendCustomMessage(type = "myCallbackHandler", words)
})
})