Update Romanian example
Change-Id: Ib3bbcb7813605fbf071cf8d5e6caea13767d55c1
diff --git a/common.R b/common.R
index af68bb8..e207647 100644
--- a/common.R
+++ b/common.R
@@ -14,6 +14,24 @@
v[order(nchar(v), v, decreasing = T)]
}
+po2en <- function(text) {
+ deeplr::translate2(
+ text,
+ target_lang = "EN",
+ source_lang = "PO",
+ auth_key = "87372412-770c-73c5-cdb9-2c6bee43afc4:fx"
+ )
+}
+
+ro2en <- function(text) {
+ deeplr::translate2(
+ text,
+ target_lang = "EN",
+ source_lang = "RO",
+ auth_key = "87372412-770c-73c5-cdb9-2c6bee43afc4:fx"
+ )
+}
+
highliteSubstrings <- function (string, substrings) {
what = paste0('(', paste0(substrings, collapse="|"), ')')
with = '<b>\\1</b>'
@@ -38,11 +56,20 @@
# mutate(Example=highliteSubstrings(example, wordsFromQuery(query))) %>%
mutate(Example=example) %>%
select(Collocate, Example, logDice, pmi, ll) %>%
- head(50) %>%
+# head(50) %>%
datatable(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)) %>%
+ select(Collocate, en, logDice, pmi, ll) %>%
+ datatable(options = list(pageLength = pageLength), escape = F) %>%
+ formatRound(columns=~logDice + pmi + ll, digits=2)
+}
+
show_simple_table <- function(df, pageLength = 20) {
df %>%
mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) %>%