Skip to content

replace_time changing ratios #67

@agbarnett

Description

@agbarnett

The replace_time function will also currently change ratios. For example,

x = "We use a training-validation-test split of 60:20:20 for both datasets."
replace_time(x)
[1] "We use a training-validation-test split of 6zero twenty and twenty seconds for both datasets."

I think the regex pattern needs a break at the start. The simplest character is a space, but this might not be ideal:

time_pattern = " (2[0-3]|[01]?[0-9]):([0-5][0-9])[.:]?([0-5]?[0-9])?"
replace_time(x, time_pattern)
[1]"We use a training-validation-test split of 60:20:20 for both datasets."
x <- c(
    NA, '12:47 to "twelve forty-seven" and also 8:35:02', 
    'what about 14:24.5', 'And then 99:99:99?'
)
replace_time(x, time_pattern)
[1] NA                                                                          
[2] "12:47 to \"twelve forty-seven\" and also eight thirty-five and two seconds"
[3] "what about fourteen twenty-four and five seconds"                          
[4] "And then 99:99:99?"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions