-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use functionality of DBpedia Spotlight #13
Comments
The docker containers are not available for all architectures. Particularly not for M1. Therefore, we need to build from the dockerfile as follows. git clone https://github.com/dbpedia-spotlight/spotlight-docker.git
cd spotlight-docker
docker build -t dbpedia/dbpedia-spotlight:latest Then run the image as follows. docker run -tid --restart unless-stopped --name dbpedia-spotlight.de --mount source=spotlight-model,target=/opt/spotlight -p 2222:80 dbpedia/dbpedia-spotlight spotlight.sh de |
This is a snippet to pass data to DBpedia Spotlight using classes from the NLP package. Two alerts:
|
I would have hoped that offset positions of input and output correspond, but that does not seem to be the case: library(jsonlite)
merkel_speeches <- corpus("GERMAPARLMINI") %>%
subset(speaker == "Angela Dorothea Merkel") %>%
as.speeches(s_attribute_name = "speaker", s_attribute_date = "date")
doc <- as(merkel_speeches[[2]], "AnnotatedPlainTextDocument")
request <- httr::GET(
url = "http://localhost:2222/rest/annotate",
query = list(
text = substr(doc[["content"]], 1, 990),
confidence = 0.35
),
httr::add_headers('Accept' = 'application/json')
)
# Output
httr::content(request, as = "text") %>%
jsonlite::fromJSON() %>%
pluck("Resources") %>%
head() %>%
.[, c("@surfaceForm", "@offset")]
# Input
as.data.frame(doc[["annotation"]]) %>%
as_tibble() %>%
mutate(word = sapply(features, `[[`, "word")) %>%
mutate(pos = sapply(features, `[[`, "pos")) %>%
select(-features) %>%
head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See this as an entry point:
https://github.com/dbpedia-spotlight/spotlight-docker
Alternative: https://opentapioca.org/ (without docker)
The text was updated successfully, but these errors were encountered: