Update in … setzen with english translations
Change-Id: I50d2e1fc20cf974982c35137e8574deff7320ede
diff --git a/common.R b/common.R
index e207647..9bd2116 100644
--- a/common.R
+++ b/common.R
@@ -32,6 +32,15 @@
)
}
+de2en <- function(text) {
+ deeplr::translate2(
+ text,
+ target_lang = "EN",
+ source_lang = "DE",
+ auth_key = "87372412-770c-73c5-cdb9-2c6bee43afc4:fx"
+ )
+}
+
highliteSubstrings <- function (string, substrings) {
what = paste0('(', paste0(substrings, collapse="|"), ')')
with = '<b>\\1</b>'
@@ -52,16 +61,24 @@
mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) %>%
mutate(example=str_replace(example, ".*(\\W+\\w+\\W+\\w+\\W+<mark.*/mark>.*)", "\\1")) %>%
mutate(example=str_replace(example, "(.*<mark.*/mark>\\W+\\w+\\W+\\w+).*", "\\1")) %>%
- rowwise() %>%
+# rowwise() %>%
# mutate(Example=highliteSubstrings(example, wordsFromQuery(query))) %>%
mutate(Example=example) %>%
- select(Collocate, Example, logDice, pmi, ll) %>%
+ select(Collocate, EN, Example, logDice, pmi) %>%
# head(50) %>%
datatable(escape = F, rownames = FALSE) %>%
- formatRound(columns=~logDice + pmi + ll, digits=2)
+ formatRound(columns=~logDice + pmi, digits=2)
}
+show_lvc_table <- function(df, pageLength = 10) {
+ df %>%
+# mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) %>%
+ select(LVC, EN, logDice, pmi, ll) %>%
+ datatable(options = list(pageLength = pageLength), escape = F, rownames = FALSE) %>%
+ formatRound(columns=~logDice + pmi + ll, digits=2)
+}
+
show_simple_table_tr <- function(df, pageLength = 20) {
df %>%
mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) %>%
diff --git a/in_NN_setzen.rds b/in_NN_setzen.rds
index cf2bb3c..0cb923d 100644
--- a/in_NN_setzen.rds
+++ b/in_NN_setzen.rds
Binary files differ
diff --git a/lvc_identification.Rmd b/lvc_identification.Rmd
index 8d390a6..4f3637f 100644
--- a/lvc_identification.Rmd
+++ b/lvc_identification.Rmd
@@ -44,7 +44,7 @@
# addExamples = TRUE
# )
setzen_ca <- readRDS("in_NN_setzen.rds")
-setzen_ca %>% show_table()
+setzen_ca %>% show_lvc_table()
```
## Romanian