Giter Site home page Giter Site logo

textgrid's People

Contributors

patrickreidy avatar teebusch avatar tjmahr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

textgrid's Issues

error when opening TextGrid files

We're having trouble opening TextGrid files using textgRid. Here is the output we get with two different approaches:

> library(textgRid)
> textgrid <- TextGrid(system.file('data', 'TatarKQ', 'File001.TextGrid'))
Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : 
  zero-length inputs cannot be mixed with those of non-zero length
In addition: Warning message:
In file(con, "r") :
  file("") only supports open = "w+" and open = "w+b": using the former
> textgrid <- TextGrid('./data/TatarKQ/File001.TextGrid')
Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : 
  zero-length inputs cannot be mixed with those of non-zero length

This is using R 3.6.3. Is there something we're doing wrong?

let find_points() and find_intervals() return NA labels by default.

The functions drop all annotations (intervals and points) with NA labels because the default for the pattern argument (used by grep) is "*".

Instead the functions should by default match all intervals and points. Otherwise it will not return (arguably very common) unlabeled points (these may be used e.g. when there is only one type of event in a tier, let's say "conversational turns". The label can then be specified in the tier name, so an additional label for each point is unnecessary). It also does not find unlabeled intervals (which e.g. may be a way to code silence).

This behavior also creates problems further down the line with as.data.frame() so that the NA labeled intervals and points are not present in the data frame. This essentially is a loss of information, because the gaps (at least the gaps at the beginning and end of the tiers) cannot be reliably reconstructed from the data frame. This also means that a TextGrid constructor for data frames will not be able to reconstruct the original TextGrid, i.e. for a textgrid object x it will not be possible to guarantee that TextGrid(as.data.frame(x)) == x

It is always easy for the user to filter NA elements later, but it shouldn't be a default that cannot be circumvented.

Grep will never match NA, regardless of the pattern, so the default has to be pattern = NULL or the like, so that grep can be done conditional on whether a pattern is supplied (e.g. if(is.null(pattern))) or not.

Example of behavior:

textgrid <- TextGrid(system.file('extdata', 'myExample.TextGrid', 
                                 package = 'textgRid'))

findPoints(textgrid@.Data[[3]])
# Index Time      Label
# 1     1 6.75  voicingOn
# 2     2 8.25 voicingOff

textgrid@.Data[[3]]@labels[1] <- NA # set 1st label to NA

findPoints(textgrid@.Data[[3]])
# Index Time      Label
# 1     2 8.25 voicingOff

Error with a TextGrid having multiple tiers

When trying to open the attached TextGrid using:
tg = TextGrid("ipiapacs_speaker0006_0005_speech_E.TextGrid")

I get the following error:

Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : 
  zero-length inputs cannot be mixed with those of non-zero length
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Warning messages:
1: In readLines(file) : line 1 appears to contain an embedded nul
2: In readLines(file) : line 2 appears to contain an embedded nul
[...]

Both with version textgRid_1.0.1 and also with the latest development version (textgRid_1.0.2)

ipiapacs_speaker0006_0005_speech_E.TextGrid.gz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.