This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(purrr) | |
library(magrittr) | |
user_input <- c(T, F, T) | |
pipe_funcs <- list(~ filter(., cyl == 4), ~ select(., cyl), nrow) | |
map2(.x = user_input, .y = pipe_funcs, | |
.f = ~ if(.x) as_mapper(.y) else NA) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options(stringsAsFactors = FALSE) | |
library(tidyverse) | |
library(pdftools) | |
library(purrr) | |
library(zoo) | |
library(readr) | |
headers_df <- | |
# read 406-page PDF of lexicon (i.e. no front matter, reversal list, etc.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(zoo) | |
library(V8) | |
lexicon <- | |
'\\lx rouge | |
\\ps adjective | |
\\de red | |
\\xv La chaise est rouge | |
\\xe The chair is red |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [3]: import run | |
--------------------------------------------------------------------------- | |
PermissionError Traceback (most recent call last) | |
<ipython-input-3-c72c9d25002d> in <module>() | |
----> 1 import run | |
~/persephone/src/run.py in <module>() | |
11 import config | |
12 import rnn_ctc | |
---> 13 import datasets.na |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@lexer wrl_lexer | |
wrlLexicon -> mainEntry:+ | |
mainEntry -> "\\me" %value englishGloss:+ "\\eme" | |
englishGloss -> "\\gl" %value:? "\\egl" | |
@{% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
input_df <- | |
readLines("Wlp-all_entries.txt") %>% | |
data.frame(line = 1:length(.), data = .) | |
id_df <- | |
input_df %>% | |
filter(grepl("^\\\\(me|sse)", data)) %>% | |
mutate(data = paste0("\\_id ", line), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(phonpack) | |
library(base64enc) | |
library(googlesheets) | |
# Get from BitBucket pipeline environment | |
BATCH_NO <- Sys.getenv("BITBUCKET_REPO_SLUG") | |
AUTH_STR <- Sys.getenv("GOOGLE_AUTH") | |
# Convert env variable to txt file, then to RDS file, then supply | |
# to gs_auth() as RDS file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(base64enc) | |
token2text <- function(token_obj, txt_file) { | |
rds_path <- tempfile() | |
saveRDS(object = token_obj, | |
file = rds_path) | |
# return base64 string | |
writeLines(base64encode(rds_path), txt_file) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use install.packages() on dplyr and tidyr | |
library(dplyr) | |
library(tidyr) | |
# mock up data frame (or use read_xlsx function from readxl package to read in an excel sheet) | |
wrl_wide <- | |
data.frame( | |
Warlpiri = c("wumparlpa", "wartarurru"), | |
`scientificName 1` = c("ecucalyptus leucophloia", "acacia validinervia"), | |
`scientificName 2` = c("eucalyptus pruinosa", "acacia jennerae") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to export TextGrid and Formant data from Praat: http://recordit.co/ybhGxsf99a | |
# Make sure to setwd() to where annotations.csv and formants.csv are located | |
library(dplyr) | |
library(readr) | |
left_join( | |
read_csv("annotations.csv") %>% mutate(join_col = "temp"), | |
read_csv("formants.csv") %>% mutate(join_col = "temp") | |
) %>% |