Skip to contents

This function sends a request to the Annif API to suggest subjects based on the provided input text.

Usage

suggest_subjects(project_id, text, limit = 10, threshold = 0, language = "en")

Arguments

project_id

The project identifier (e.g., "yso-en").

text

The input text for which subjects are to be suggested.

limit

An optional parameter to specify the maximum number of results to return. Default is 10.

threshold

An optional parameter to specify the minimum score threshold for results. Default is 0.

language

An optional parameter to specify the language of subject labels. Default is "en".

Value

A tibble containing suggested subjects, including their labels, URIs, and scores.

Examples

suggestions <- suggest_subjects(project_id = "yso-en",
text = "Jean Sibelius orchestra music and composer")
print(suggestions)
#> # A tibble: 10 × 3
#>    label                uri                                score
#>    <chr>                <chr>                              <dbl>
#>  1 composers            http://www.yso.fi/onto/yso/p2353  0.682 
#>  2 biographical history http://www.yso.fi/onto/yso/p2718  0.536 
#>  3 art music            http://www.yso.fi/onto/yso/p18434 0.356 
#>  4 music                http://www.yso.fi/onto/yso/p1808  0.266 
#>  5 composing            http://www.yso.fi/onto/yso/p13332 0.201 
#>  6 orchestras           http://www.yso.fi/onto/yso/p5070  0.187 
#>  7 compositions (music) http://www.yso.fi/onto/yso/p1515  0.115 
#>  8 orchestral music     http://www.yso.fi/onto/yso/p13806 0.0908
#>  9 jeans                http://www.yso.fi/onto/yso/p19836 0.0859
#> 10 symphony orchestras  http://www.yso.fi/onto/yso/p19581 0.0767