-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.Rmd
More file actions
executable file
·125 lines (96 loc) · 4.11 KB
/
Copy pathdatabase.Rmd
File metadata and controls
executable file
·125 lines (96 loc) · 4.11 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
output:
html_document:
output_dir: docs
include:
after_body: footer.html
knit: (function(inputFile, encoding) {
out_dir <- 'docs';
rmarkdown::render(inputFile,
encoding=encoding,
output_file=file.path(dirname(inputFile), out_dir, 'index.html')) })
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo=FALSE, message=FALSE, warning = FALSE)
library(tidyverse)
library(DT)
library(leaflet)
library(htmltools)
library(sf)
# coordinates <- tribble(~language, ~latitude, ~longitude,
# "Permyak", 59.01, 54.65,
# "Zyrian", 61.66, 50.81)
#
# write_csv(coordinates, "coordinates.csv")
comparison <- read_csv("database.csv") %>%
mutate(comment = case_when(is.na(comment) ~ "",
TRUE ~ as.character(comment)))
## In principle we could transform languages into columns too
# pivot_wider(names_from = language) %>%
# select(Permyak, Zyrian, everything())
coordinates <- read_csv("coordinates.csv")
komi_polygon <- st_read("https://raw.githubusercontent.com/nikopartanen/language_maps/master/geojson/kom.geojson")
komi_polygon <- left_join(komi_polygon %>% rename(polygon_id = dial), coordinates)
comparison <- comparison %>% left_join(coordinates %>% select(polygon_id, language))
create_map <- function(data, feature_name){
my_colors <-
c(
"#1f77b4",
"#ff7f0e",
"#2ca02c",
"#d62728",
"#9467bd",
"#8c564b",
"#e377c2",
"#7f7f7f",
"#17becf",
sample(grDevices::colors()[!grepl("ivory|azure|white|gray|grey|black|pink|1",
grDevices::colors())])
)
corpus <- data
current_selection <- corpus %>%
filter(feature == feature_name) %>%
arrange(language)
pal <- colorFactor({my_colors[1:length(unique(current_selection$value))]},
domain = current_selection$value)
title_text <- current_selection$feature[1] %>% as.character()
leaflet(data = current_selection) %>%
addTiles() %>%
addCircleMarkers(lng = ~longitude,
lat = ~latitude,
color = ~pal(value),
radius = 8,
stroke = FALSE, fillOpacity = 0.8,
popup = ~language) %>%
# addPolygons(fillColor = ~pal(value))
addLegend("bottomleft", pal = pal, values = ~value,
title = title_text,
opacity = 1
)# %>%
#addControl(title, position = "topleft", className="map-title")
}
```
### Comparative database of Permic varieties {.tabset .tabset-fade .tabset-pills}
#### About
This database accompanies the paper *On the questions in developing computational infrastructure for Komi-Permyak* by Rueter, Partanen & Ponomareva. The goal of that study was investigate the most central differences that must be accounted for when adapting Komi-Zyrian morphological analyser to work on Komi-Permyak. The features discussed in the paper are collected here into a database that can be extended later.
The data is shared under CC-0, in order to allow as unproblematic reuse as possible.
#### Search {.tabset .tabset-fade .tabset-pills}
```{r}
datatable(comparison %>% select(-polygon_id), filter = 'top', rownames = FALSE, options = list(dom = 'tip'), escape = FALSE)
```
#### Maps {.tabset .tabset-fade .tabset-pills}
This section contains automatically generated maps of all presented features.
```{r}
map_chunks <- comparison %>%
distinct(feature) %>%
pull(feature) %>%
map(~ {create_map(comparison %>% left_join(coordinates, by = "language"), .x)})
# THIS IS VERY UNFINISHED
# map_chunks <- comparison %>%
# distinct(feature) %>%
# pull(feature) %>%
# map(~ {create_map(comparison %>% left_join(komi_polygon %>% select(-language, -comment)), .x)})
tagList(map_chunks)
```