-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.qmd
53 lines (49 loc) · 1.77 KB
/
data.qmd
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
---
language: custom.yml
editor_options:
chunk_output_type: console
---
```{r}
library(tidyverse)
create_image_look_up <- function(img_src,
snd_src,
text = "👁") {
paste0(
"<a ",
"onmouseover=\"resize(this, '200%')\" ",
"onmouseout=\"resize(this, '100%')\" ",
"onclick = \"window.open('",
img_src,
"', 'targetWindow', 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1090px, height=550px, top=25px left=120px'); sound_play('",
snd_src,
"');return false;\">",
text,
"</a>"
)
}
readxl::read_xlsx("data/data.xlsx", guess_max = 2000) |>
filter(!is.na(idiom),
!is.na(intonation_type),
intonation_type != "образец",
intonation_type != "ОБРАЗЕЦ") |>
mutate(image = create_image_look_up(str_c("https://github.com/LingConLab/PRuD/raw/main/images/", filename, ".png"),
str_c("https://github.com/LingConLab/PRuD/raw/main/audio/", filename, ".wav")),
idiom = str_c("<a href = 'dialects.html#", link, "'>", idiom, "</a>")) |>
select(-c(latitude, longitude, filename)) |>
mutate(across(everything(), as_factor)) |>
mutate(transcription = as.character(transcription),
transcription2 = as.character(transcription2)) |>
select(intonation_type, transcription, transcription2, image, speaker, idiom, village, district, region, comment) |>
DT::datatable(escape = FALSE, rownames = FALSE, filter = 'top',
options = list(pageLength = 20, dom = 'top'))
```
<script>
function sound_play(x) {
var audio = new Audio();
audio.src = x;
audio.play();
}
function resize(elem, percent) {
elem.style.fontSize = percent;
}
</script>