IPS-LMU / emuR

The main R package for the EMU Speech Database Management System (EMU-SDMS)
http://ips-lmu.github.io/EMU.html
23 stars 15 forks source link

condition has length > 1 when submitting language data frame to BAS webservice functions #272

Closed johannacronenberg closed 10 months ago

johannacronenberg commented 11 months ago

https://github.com/IPS-LMU/emuR/blob/eb703f23c8295c76952aa786d149c67a7b2df9b2/R/emuR-bas_webservicesDBI.R#L2341

I submitted a data frame for the argument "language" in the runBASwebservice_g2pForTokenization() function and the following error was returned:

Error in if (unique(language$bundle) != unique(bundles$bundle)) { : the condition has length > 1

I suspect that the problem is in the line of code indicated above and might be solved by replacing the line with:

if (! all(sort(unique(language$bundle)) == sort(unique(bundles$name))))

Here is a way of replicating the bug:

create_emuRdemoData(dir = tempdir()) path2ae <- file.path(tempdir(), "emuR_demoData", "ae_emuDB") ae <- load_emuDB(path2ae, verbose = F) langs <- list_bundles(ae) %>% rename(bundle = name) %>% mutate(language = c(rep("deu-DE", times = 3), rep("ita-IT", times = 4))) runBASwebservice_g2pForTokenization(handle = ae, transcriptionAttributeDefinitionName = "Utterance", language = langs, orthoAttributeDefinitionName = "word")