Skip to contents

Search words in the texts collection.

Usage

search_texts(lexadb, word = NULL, whole = TRUE, gloss = NULL)

Arguments

lexadb

A lexadb object (created with load_lexadb).

word

A regular expression to search among the sentences.

whole

Whether to search for whole words (TRUE by default).

gloss

A regular expression to search among the glosses.

Value

A list of lexalx objects.

Examples

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

search_texts(albanian, "rrezet")
#>  Found 1 matches.
#> $tx_000001
#> 
#> ── The North Wind and the Sun ──────────────────────────────────────────────────
#> 
#> ── st_000007 ──
#> 
#> Pastaj Dielli lëshoi rrezet e tij të ngrohta dhe menjëherë udhëtari e hoqi
#> pallton.
#> Then the Sun released his warm rays and immediately the traveller took off his
#> cloak.
#> 
search_texts(albanian, gloss = "sun")
#>  Found 3 matches.
#> $tx_000001
#> 
#> ── The North Wind and the Sun ──────────────────────────────────────────────────
#> 
#> ── st_000001 ──
#> 
#> Era e Veriut dhe Dielli po ziheshin se kush ishte më i fortë.
#> The North Wind and the Sun were disputing which was the stronger,
#> 
#> ── st_000007 ──
#> 
#> Pastaj Dielli lëshoi rrezet e tij të ngrohta dhe menjëherë udhëtari e hoqi
#> pallton.
#> Then the Sun released his warm rays and immediately the traveller took off his
#> cloak.
#> 
#> ── st_000008 ──
#> 
#> E kështu Era e Veriut u detyrua të pranonte që Dielli ishte më i fortë se ajo.
#> And so the North Wind was forced to accept that the Sun was the stronger than
#> itself.
#> 
search_texts(albanian, gloss = "traveller")
#>  Found 4 matches.
#> $tx_000001
#> 
#> ── The North Wind and the Sun ──────────────────────────────────────────────────
#> 
#> ── st_000002 ──
#> 
#> Kur aty kaloi një udhëtar që kishte veshur një pallto të ngrohtë.
#> when a traveller came along wrapped in a warm cloak.
#> 
#> ── st_000003 ──
#> 
#> Ata ranë dakord që kush do ta bënte udhëtarin të hiqte pallton më përpara do të
#> quhej më i forti.
#> They agreed that the one who first succeeded in making the traveller take his
#> cloak off first should be considered the stronger one.
#> 
#> ── st_000005 ──
#> 
#> por sa më shumë që frynte aq më shumë kapej udhëtari pas palltos së tij,
#> but the more he blew the more closely did the traveller fold his cloak around
#> him,
#> 
#> ── st_000007 ──
#> 
#> Pastaj Dielli lëshoi rrezet e tij të ngrohta dhe menjëherë udhëtari e hoqi
#> pallton.
#> Then the Sun released his warm rays and immediately the traveller took off his
#> cloak.
#>