PolMine / dbpedia

R Wrapper for Corpus Annotation with DBpedia Spotlight
3 stars 0 forks source link

dbpedia_links fails if no links found? #6

Closed ablaette closed 1 year ago

ablaette commented 1 year ago

This is my interpretation why the following code fails. There should be an informative message, if no links/matches are found.

doc <- corpus("NADIRASZ") %>% 
   subset(article_id == "A24554563")
dbpedia_links <- get_dbpedia_links(x = doc, language = "de")
✔ convert input to `AnnotatedPlainTextDocument` [84ms]
✔ send request to DBpedia Spotlight [293ms]
✔ parse result [41ms]

Warning message: In stri_sub(str = s, from = start, to = end) : argument is not an atomic vector; coercing

ablaette commented 1 year ago

I updated the sample code as follows:

library(dbpedia)
library(polmineR)

doc <- corpus("NADIRASZ") %>% 
  subset(article_id == "A24554563")
dbpedia_links <- get_dbpedia_uris(x = doc, language = "de")

I do not See an error any more, so I close this issue.