-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.R
35 lines (26 loc) · 1.14 KB
/
server.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
# CC-BY Niko Partanen, Freiburg Research Project in Saami Studies / Izhva Komi Language Documentation Project
# Funded by Kone Foundation
source("mgsub.R")
source("transliterate.R")
library(shiny)
library(markdown)
library(dplyr)
shinyServer(function(input, output) {
# You can access the value of the widget with input$text, e.g.
output$text <- renderPrint({ new_text <- transliterate(tolower(
input$text), model = input$outputModel)
new_text
})
new_text <- reactive({
new_text <- transliterate(tolower(input$text), model = input$outputModel)
new_text <- gsub("<br/>", "\n", new_text)
new_text
})
output$downloadData <- downloadHandler(
filename = function() {
paste(gsub("patterns/(.+).csv", "\\1", input$outputModel), "_", Sys.Date(), ".txt", sep='')
},
content = function(file) {
write.table(new_text(), file, quote = FALSE, row.names = FALSE, col.names = FALSE)
})
})