Search phones
ph_search.Rd
Given a vector of phonetised strings, find phones.
Arguments
- phlist
The output of
phonetise()
.- phonex
A phonetic expression. Supported shorthands are
C
for consonant,V
for vowel, and#
for word boundary.
Examples
ipa <- c("p\u02B0a\u0303k\u02B0", "t\u02B0um\u0325", "\u025Bk\u02B0\u026F", "pun")
ph <- c("p\u02B0", "t\u02B0", "k\u02B0", "a\u0303", "m\u0325")
ipa_ph <- phonetise(ipa, multi = ph)
ph_search(ipa_ph, "#CV")
#> [[1]]
#> [1] "pʰã"
#>
#> [[2]]
#> [1] "tʰu"
#>
#> [[3]]
#> character(0)
#>
#> [[4]]
#> [1] "pu"
#>
# partial matches are also returned
ph_search(ipa_ph, "p")
#> [[1]]
#> [1] "p"
#>
#> [[2]]
#> character(0)
#>
#> [[3]]
#> character(0)
#>
#> [[4]]
#> [1] "p"
#>
# use regular expressions
ph_search(ipa_ph, "p\u02B0?V")
#> [[1]]
#> [1] "pʰã"
#>
#> [[2]]
#> character(0)
#>
#> [[3]]
#> character(0)
#>
#> [[4]]
#> [1] "pu"
#>