Retrieving tiers

Retrieving tier metadata

One may need to read only the tiers in files for purposes of inspecting the tier structure, such as which tiers and tier types exist, and which parent-child relationships and associated CVs are present. This can easily be done with the read_tiers() function, which allows three types of input files:

  • ELAN annotation files (.eaf)
  • ELAN template files (.etf)
  • ELAN external controlled vocabularies (.ecv)

EAF files

library(readelan)

eaf_file <- system.file("extdata", 
                        "example.eaf", 
                        package = "readelan")

tiers <- read_tiers(eaf_file)

head(tiers)
     filename  tier_type   tier participant annotator parent_ref language_ref
1 example.eaf default-lt  words        s001       ABC       <NA>         <NA>
2 example.eaf        pos    pos        s001       DEF      words          eng
3 example.eaf     syntax syntax        s001       GHI      words          eng
            constraint cv_ref
1                 <NA>   <NA>
2 Symbolic_Association    pos
3 Symbolic_Association syntax

ETF files

library(readelan)

etf_file <- system.file("extdata", 
                        "CLP_annotation_v2-2.etf", 
                        package = "readelan")

tiers <- read_tiers(etf_file)

head(tiers)
                 filename         tier_type            tier participant
1 CLP_annotation_v2-2.etf          CLP main   CLP handshape        <NA>
2 CLP_annotation_v2-2.etf    CLP congruence  CLP congruence        <NA>
3 CLP_annotation_v2-2.etf         CLP event       CLP event        <NA>
4 CLP_annotation_v2-2.etf   CLP interaction CLP interaction        <NA>
5 CLP_annotation_v2-2.etf     CLP discourse          CLP DS        <NA>
6 CLP_annotation_v2-2.etf CLP no vocabulary    CLP movement        <NA>
  annotator    parent_ref language_ref           constraint          cv_ref
1      <NA>          <NA>         <NA>                 <NA>   CLP handshape
2      <NA> CLP handshape         <NA> Symbolic_Association  CLP congruence
3      <NA> CLP handshape         <NA> Symbolic_Association       CLP event
4      <NA> CLP handshape         <NA> Symbolic_Association CLP interaction
5      <NA> CLP handshape         <NA> Symbolic_Association   CLP discourse
6      <NA> CLP handshape         <NA> Symbolic_Association            <NA>

ECV files

library(readelan)

ecv_file <- system.file("extdata", 
                        "syntax.ecv", 
                        package = "readelan")

tiers <- read_tiers(ecv_file)

head(tiers)
data frame with 0 columns and 0 rows

Additional arguments

Writing full paths

The full_path argument simply determines whether the full file path input should be written to the output data frame as the filename (if TRUE; e.g., “/path/to/elan_file.eaf”), or whether it should be shortened to the base name only (if FALSE, the default; e.g., “elan_file.eaf”).

Progress bar

If progress is set to TRUE, a progress bar will be printed to the console as files are read. This is mostly useful when reading multiple files that take some time to complete (see Multiple files).