An open API service indexing awesome lists of open source software.

https://github.com/agricolamz/uvular_database

Uvular consonants in Languages of the Caucasus
https://github.com/agricolamz/uvular_database

database linguistics phonology r-markdown

Last synced: about 2 months ago
JSON representation

Uvular consonants in Languages of the Caucasus

Awesome Lists containing this project

README

        

---
author: "G. Moroz, S. Martynova"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE)
```

### On Uvular Consonants in Languages of the Caucasus {.tabset .tabset-fade .tabset-pills}
Authors: S. Martynova, G. Moroz

Here is an [abstract](https://www.overleaf.com/7958421gcxnsztnxdqn). Download database: [.csv](https://raw.githubusercontent.com/agricolamz/uvular_database/master/uvular_database.csv)

#### about database
Here is a map of the languages from database:
```{r}
library(tidyverse)
setwd("/home/agricolamz/_DATA/OneDrive1/_Work/Abstracts/2017 I 17.04.15-19 Uvulars Paris")
uvular <- read.csv("uvular_database.csv", stringsAsFactors = F, quote = "\"")
# install.packages("devtools"); devtools::install_github("agricolamz/lingtypology", dependencies = TRUE)
uvular$popup <- sapply(uvular$language, function(x){
paste(uvular[uvular$language == x, 2], collapse = ", ")
})
uvular$uvular_number <- factor(sapply(uvular$language, function(x){
length(uvular[uvular$language == x, 2])
}))

uvular$type <- "small (<4)"
uvular[as.integer(uvular$uvular_number) > 7, 8] <- "large (>7)"
uvular[as.integer(uvular$uvular_number) < 8 & as.integer(uvular$uvular_number) > 3, 8] <- "average"
uvular$type <- factor(uvular$type, levels = c("small (<4)", "average", "large (>7)"))

library(lingtypology)
map.feature(unique(uvular[,-2])$language, control = F, tile = "CartoDB.Positron", popup = unique(uvular[,-2])$popup, features = unique(uvular[,-2])$type)
```

#### search
```{r}
library(DT)
datatable(uvular[,-c(3, 4, 5, 6)], filter = 'top', rownames = FALSE, options = list(pageLength = 30, dom = 'tip'), escape = FALSE)
```

#### summary
```{r}
library(DT)
datatable(unique(uvular[,-c(2, 4, 5, 6)]), filter = 'top', rownames = FALSE, options = list(pageLength = 30, dom = 'tip'), escape = FALSE)
```

#### graphs
```{r}
library(tidyverse)
my.data <- unique(uvular[,c(1, 5, 7)])
my.data2 <- unique(uvular[,c(1, 7)])
my.data %>%
ggplot(aes(uvular_number, fill = family))+
geom_bar(data = my.data2, fill = "lightgrey")+
geom_bar()+
xlab("number of uvulars")+
ylab("number of languages")+
scale_y_continuous(breaks = 1:5*2) +
theme_bw()+
facet_wrap(~family, scales = "free")+
guides(fill=FALSE)+
labs(title = "Number of uvulars by branch",
subtitle = "All together shadow is colored in grey")

```
```{r}
sort(table(uvular$uvular), decreasing = T)
```

#### coocure
```{r, message=FALSE, warning=FALSE}
# create all possible сombinations
all.combination <- expand.grid(uvular$uvular, uvular$uvular, stringsAsFactors = F)
# delete duplicates
all.combination <- all.combination[all.combination[,1] != all.combination[,2],]

all.combination$combo <- mapply(function(pattern_1, pattern_2){
paste0(sort(c(pattern_1, pattern_2)), collapse = "")},
all.combination[,1], all.combination[,2])

all.combination <- all.combination[!duplicated(all.combination$combo),]
all.combination <- all.combination[,-3]

pattern_and_pattern <- function(pattern_1, pattern_2){
grepl(pattern_1, uvular[uvular$language == langs,6][1])&
grepl(pattern_2, uvular[uvular$language == langs,6][1])}

all.combination.copy <- all.combination
sapply(1:39, function(x){
langs <<- unique(uvular$language)[x]
mapply(function(pattern_1, pattern_2){
pattern_and_pattern(pattern_1, pattern_2)},
all.combination[,1], all.combination[,2]) ->> all.combination.copy[,2+x]}) -> df

all.combination$sum <- apply(all.combination.copy[,c(3:41)], 1, sum)
names(all.combination) <- c("segment 1", "segment 2", "number of languages")

combination <- all.combination[complete.cases(all.combination$`number of languages`),]

combination <- combination[as.integer(combination$`number of languages`) > 0,]

library(DT)
datatable(combination, filter = 'top', rownames = FALSE, options = list(pageLength = 30, dom = 'tip'), escape = FALSE)

# combination %>%
# arrange(desc(`number of languages`)) %>%
# spread(`segment 2`, `number of languages`) ->
# combination
#
# write.csv(combination, "combinations.csv", row.names = F)

```