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.701 
#>  2 biographical history  http://www.yso.fi/onto/yso/p2718  0.516 
#>  3 art music             http://www.yso.fi/onto/yso/p18434 0.398 
#>  4 music                 http://www.yso.fi/onto/yso/p1808  0.319 
#>  5 composing             http://www.yso.fi/onto/yso/p13332 0.252 
#>  6 orchestras            http://www.yso.fi/onto/yso/p5070  0.202 
#>  7 compositions (music)  http://www.yso.fi/onto/yso/p1515  0.167 
#>  8 orchestral music      http://www.yso.fi/onto/yso/p13806 0.118 
#>  9 history of music      http://www.yso.fi/onto/yso/p14569 0.112 
#> 10 composers' opus lists http://www.yso.fi/onto/yso/p18858 0.0720