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

Cannot export secondary attributes of SEGMENT level to TextGrid collection #264

Open trblslp opened 2 years ago

trblslp commented 2 years ago

Using the demo data, first make a new attribute for the Phonetic level, called Phonetic2, and copy the annotations from the former to the latter using the update_itemsInLevel() function.

# add attribute def
add_attributeDefinition(ae,
                        levelName = "Phonetic",
                        name = "Phonetic2")
# query orig level
phones <- query(ae,
      "Phonetic =~ .*")
# change attribute name
phones <- phones %>% 
  mutate(attribute = "Phonetic2")
# use resulting seglist to populate annotations on new attribute
update_itemsInLevel(ae,
                    phones)

We now have annotations for the new attribute:

query(ae,
      "Phonetic2 =~ .*")
Screen Shot 2022-06-16 at 5 24 41 pm

Then export as a TextGrid collection:

export_TextGridCollection(ae,
                          targetDir = "./Export_demo",
                          attributeDefinitionNames = c("Phonetic", "Phonetic2", "Word", "Accent"),
                          timeRefSegmentLevel = "Phonetic")

But, there are in fact no annotations at all on the TextGrid tier corresponding to the new attribute. Note that it doesn't seem to matter here whether we specify the timeRefSegmentLevel or not (although specifying it as the Phonetic2 level throws an error). However, we do find annotations for secondary tiers if they are of the ITEM type, as we can see for the Accent tier.

Screen Shot 2022-06-16 at 5 18 45 pm

I suspect this issue bears some relation to this other one, but I can't say why.