Displaying 1 result from an estimated 1 matches for "ff_ff".
Did you mean:
__fff
2012 Sep 14
1
please comment on my function
...<- tolower(s)
long <- nchar(s) == 5
s[long] <- sub("^([a-z]{2})[-_][a-z]{2}$","\\1",s[long])
s[nchar(s) != 2 & s != "c"] <- "unknown"
s
}
canonicalize.language(c("aa","bb-cc","DD-abc","eee","ff_FF","C"))
[1] "aa" "bb" "unknown" "unknown" "ff" "c"
--8<---------------cut here---------------end--------------->8---
it does what I want it to do, but it takes 4.5 seconds on a vector of
length 10,256,...