Skip to content

Commit

Permalink
next version
Browse files Browse the repository at this point in the history
  • Loading branch information
agricolamz committed Jul 13, 2024
1 parent d45b84e commit 73e6649
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: phonfieldwork
Type: Package
Title: Linguistic Phonetic Fieldwork Tools
Version: 0.0.13
Version: 0.0.15
Depends: R (>= 3.5.0)
Imports:
tuneR,
Expand Down
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# phonfieldwork 0.0.15

- small fix in `df_to_tier` of cases with non-equal time_end and time_start values in the dataframe


# phonfieldwork 0.0.14

- small fix

# phonfieldwork 0.0.13

- fix encoding detection

# phonfieldwork 0.0.12

- add a `separate_duration` argument to the `concatenate_soundfiles()` function that makes it possible to use some silent separator during the file concatenation.
Expand Down
12 changes: 12 additions & 0 deletions R/df_to_tier.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ df_to_tier <- function(df, textgrid, tier_name = "", overwrite = TRUE) {
df <- df[, -which(names(df) %in% "time_end")]
}

if (TRUE %in% (df$time_end[-nrow(df)] != df$time_start[-1])){
wrong_time_end <- which(df$time_end[-nrow(df)] != df$time_start[-1])
silence <- lapply(wrong_time_end, function(i){
df <<- rbind(df[c(1:i),],
data.frame(time_start = df$time_end[i],
time_end = df$time_start[i+1],
content = ""),
df[-c(1:i),]
)
})
}

tier_class <- ifelse("time_end" %in% names(df),
' class = "IntervalTier" ',
' class = "TextTier" '
Expand Down
2 changes: 1 addition & 1 deletion R/utils.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ read_textgrid <- function(file_name) {
} else {
# thanks to Artem Klevtsov for this code
con <- file(file_name,
encoding = readr::guess_encoding(file_name)$encoding)
encoding = readr::guess_encoding(file_name)$encoding[1])
tg <- readLines(con)
close(con)
}
Expand Down
12 changes: 9 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
"codeRepository": "https://github.com/ropensci/phonfieldwork",
"issueTracker": "https://github.com/ropensci/phonfieldwork/issues",
"license": "https://spdx.org/licenses/GPL-2.0",
"version": "0.0.13",
"version": "0.0.15",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.3.3 (2024-02-29)",
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"author": [
{
"@type": "Person",
Expand Down Expand Up @@ -229,7 +235,7 @@
},
"SystemRequirements": "pandoc (>= 1.14) - http://pandoc.org"
},
"fileSize": "4059.603KB",
"fileSize": "2085.848KB",
"citation": [
{
"datePublished": "2023",
Expand Down

0 comments on commit 73e6649

Please sign in to comment.