I'm trying to extract those phonemes that reoccur in words. I've phonemic transcriptions of words such as these:
x <- c("saɪəns", "ɪvɒlvd", "ˌʌndəstænd", "skɑːb(ə)rə", "pəteɪtəʊ", "dɪskraɪbd")
Using gsub and backreference, I can do this:
gsub(".*(.).*\\1.*", "\\1", x, perl = T)
[1] "s" "v" "d" "ə" "t" "ɪ"
However the result is incomplete, as only one repeated letter is outputted; the complete result would be:
[1] "s" "v" "nd" "ə" "ət" "dɪ"
I've tried it with multiple backreference but this outputs the entire strings:
gsub(".*(.).*\\1.*(.).*\\2", "\\1\\2", x, perl = TRUE)
[1] "saɪəns" "ɪvɒlvd" "ˌʌndəstænd" "skɑːb(ə)rə" "pəteɪtəʊ" "dɪskraɪbd"
Can anybody help?