knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

library(spotlight)

spotlight

Travis build status AppVeyor Build Status

R wrapper to the DBpedia Spotlight API. All official documentation is online.

It is a tool for automatically annotating mentions of DBpedia resources in text, providing a solution for linking unstructured information sources to the Linked Open Data cloud through DBpedia. - DBpedia Spotlight

Global options are set with spot_set_opts.

Installation

You can install spotlight from github with:

# install.packages("devtools")
devtools::install_github("news-r/spotlight")

Examples

library(spotlight)

# Data to extract entities from 
text = c(
  "Donald Trump is probably in Washington DC.",
  "szzza dasdazsd azzsd daawq", # garbage
  "" # empty document
)

# remove empty documents
text <- spot_filter(text)

# Annotate
places <- spot_annotate(text, types = "DBpedia:Place")

knitr::kable(places)


news-r/spotlight documentation built on Feb. 29, 2020, 5:11 a.m.