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

create_itemsInLevel is does not work for segments with multiple attributes #266

Open FredrikKarlssonSpeech opened 1 year ago

FredrikKarlssonSpeech commented 1 year ago

There are some issues with create_itemsInLevel, and one of them is that if you have a SEGMENT level with multiple attributes, than you cannot add labels to them.

marks
# A tibble: 8 × 8
  session name               row start_item_seq_idx labels level attribute start
  <chr>   <chr>            <dbl>              <dbl> <chr>  <chr> <chr>     <dbl>
1 0000    dâlem_iso_1_mis      1                  1 1      EGG   EGG       0.002
2 0000    dâlem_iso_1_mis      1                  1 1      EGG   two       0.002
3 0000    dhâlem_iso_1_mis     1                  1 1      EGG   EGG       0.002
4 0000    dhâlem_iso_1_mis     1                  1 1      EGG   two       0.002
5 0000    talam_iso_1_mis      1                  1 1      EGG   EGG       0.002
6 0000    talam_iso_1_mis      1                  1 1      EGG   two       0.002
7 0000    talam_sen_1_mis      1                  1 1      EGG   EGG       0.002
8 0000    talam_sen_1_mis      1                  1 1      EGG   two       0.002
> edf %>% full_join(te) -> marks
Joining, by = "row"
> edf %>% full_join(te) %>% rename(bundle = name) -> marks
Joining, by = "row"
> marks
# A tibble: 8 × 8
  session bundle             row start_item_seq_idx labels level attribute start
  <chr>   <chr>            <dbl>              <dbl> <chr>  <chr> <chr>     <dbl>
1 0000    dâlem_iso_1_mis      1                  1 1      EGG   EGG       0.002
2 0000    dâlem_iso_1_mis      1                  1 1      EGG   two       0.002
3 0000    dhâlem_iso_1_mis     1                  1 1      EGG   EGG       0.002
4 0000    dhâlem_iso_1_mis     1                  1 1      EGG   two       0.002
5 0000    talam_iso_1_mis      1                  1 1      EGG   EGG       0.002
6 0000    talam_iso_1_mis      1                  1 1      EGG   two       0.002
7 0000    talam_sen_1_mis      1                  1 1      EGG   EGG       0.002
8 0000    talam_sen_1_mis      1                  1 1      EGG   two       0.002
> list_levelDefinitions(egg)
  name    type nrOfAttrDefs attrDefNames
1  EGG SEGMENT            1         EGG;
> add_attributeDefinition(egg,levelName = "EGG",name = "two")
  INFO: Rewriting 4 _annot.json files to file system...
  |===============================================================================================================================================================================================================| 100%
> create_itemsInLevel(egg,itemsToCreate = marks)
Error in create_itemsInLevel(egg, itemsToCreate = marks) : 
  Found duplicate sample_start values on same level

The documentation could need some looking over too, but duplicate start ids is kind of the point when you are assigning multiple level attributes, so this needs fixing (and clarification with clear examples).