Skip to contents

Search entries in the lexicon, by entry form or sense definitions.

Usage

search_lexicon(
  lexadb,
  entry = NULL,
  whole = TRUE,
  definition = NULL,
  pos = NULL
)

Arguments

lexadb

A lexadb object (created with load_lexadb).

entry

A regular expression to search among entries.

whole

Whether to search for whole words (only applies to entry, TRUE by default).

definition

A regular expression to search among sense definitions.

pos

A regular expression to match the part of speech.

Value

A list of lexalx objects.

Examples

db_path <- system.file("extdata/eleryon_lexadb", package = "lexa")
eleryon <- load_lexadb(db_path)
#>  Loading lexa database...

# Search for "chǭs"
search_lexicon(eleryon, "chǭs")
#>  Found 1 entry.
#> 
#> ── Entry lx_000005 ─────────────────────────────────────────────────────────────
#> chǭs [tʃɵːs] adverb
#> 
#> ── Senses ──
#> 
#> 1. tomorrow
#> 
#> ── Grammatical info ──
#> 
#> Category: lexical
#> Type: root
#> 
#> ── Allomorphs ──
#> 
#>  chǭs [tʃɵːs]
#> 
#> ── Notes ──
#> 
#> • Note that in Eleryon this word means 'tomorrow' if used by noon, otherwise it
#> means 'the day after tomorrow'.

# Search for all verbs
search_lexicon(eleryon, ".*", pos = "verb")
#>  Found 5 entries.
#> 
#> ── Entry lx_000002 ─────────────────────────────────────────────────────────────
#> unullose [unullose] verb (IV)
#> 
#> ── Senses ──
#> 
#> 1. to love
#> 
#> ── Grammatical info ──
#> 
#> Category: lexical
#> Type: root
#> 
#> ── Allomorphs ──
#> 
#>  nul [nul]
#>  unul [unul]
#> 
#> ── Entry lx_000003 ─────────────────────────────────────────────────────────────
#> vēselse [veɪselse] verb (II)
#> 
#> ── Senses ──
#> 
#> 1. to understand
#> 2. to learn
#> 
#> ── Grammatical info ──
#> 
#> Category: lexical
#> Type: root
#> 
#> ── Allomorphs ──
#> 
#>  vēsel [veɪsel]
#> 
#> ── Entry lx_000004 ─────────────────────────────────────────────────────────────
#> evēsellose [eveɪsellose] verb (IV)
#> 
#> ── Senses ──
#> 
#> 1. to teach
#> 
#> ── Etymology ──
#> 
#> From vēselse 'to learn'.
#> 
#> ── Grammatical info ──
#> 
#> Category: lexical
#> Type: root
#> 
#> ── Allomorphs ──
#> 
#>  vēsel [veɪsel]
#>  evēsel [eveɪsel]
#> 
#> ── Entry lx_000005 ─────────────────────────────────────────────────────────────
#> chǭs [tʃɵːs] adverb
#> 
#> ── Senses ──
#> 
#> 1. tomorrow
#> 
#> ── Grammatical info ──
#> 
#> Category: lexical
#> Type: root
#> 
#> ── Allomorphs ──
#> 
#>  chǭs [tʃɵːs]
#> 
#> ── Notes ──
#> 
#> • Note that in Eleryon this word means 'tomorrow' if used by noon, otherwise it
#> means 'the day after tomorrow'.
#> 
#> ── Entry lx_000006 ─────────────────────────────────────────────────────────────
#> urųrtose [uryrtose] verb (I)
#> 
#> ── Senses ──
#> 
#> 1. to sit
#> 
#>           ── Examples 
#>           Ęs ętsu urųrtō enēim kę̄syoh bhųl enēim āireᵃph likhpyūaq. [tx
#>           000001:st_000001]
#>           And then I sat on a rock, while it was raining over me.
#>           
#>           Ksǫnteziṇ gartosesī ōroi Vāisi su Meukha su vēsyēl selo ellāimōma e
#>           ēim āireᵃph. [tx_000001:st_000002]
#>           With pleasure I tell you about the Sun, the Moon and the stars that
#>           are above us.
#>           
#> 
#> ── Grammatical info ──
#> 
#> Category: lexical
#> Type: root
#> 
#> ── Allomorphs ──
#> 
#>  ųrt [yrt]
#>  urųrt [uryrt]

# Search for entry with meaning "love"
search_lexicon(eleryon, definition = "love")
#>  Found 1 entry.
#> 
#> ── Entry lx_000002 ─────────────────────────────────────────────────────────────
#> unullose [unullose] verb (IV)
#> 
#> ── Senses ──
#> 
#> 1. to love
#> 
#> ── Grammatical info ──
#> 
#> Category: lexical
#> Type: root
#> 
#> ── Allomorphs ──
#> 
#>  nul [nul]
#>  unul [unul]