Как установить sh соединение для использования dbpediaSpotlight в python? - PullRequest
0 голосов
/ 02 мая 2020

Я программирую python в Jupyter Notebook, но когда я запускаю этот код:

import requests
import re
import spotlight

document = 'First documented in the 13th century, Berlin was the capital of the Kingdom of Prussia 
(1701–1918), the German Empire (1871–1918), the Weimar Republic (1919–33) and the Third Reich (1933– 
45). Berlin in the 1920s was the third largest municipality in the world. After World War II, the 
city became divided into East Berlin -- the capital of East Germany -- and West Berlin, a West German 
exclave surrounded by the Berlin Wall from 1961–89. Following German reunification in 1990, the city 
regained its status as the capital of Germany, hosting 147 foreign embassies.'
annotations = spotlight.annotate('http://spotlight.dbpedia.org/rest', document,confidence=0.5, 
support=20)

Это показывает эту ошибку, как я могу ее запустить?

ConnectionError: HTTPSConnectionPool(host='www.dbpedia-spotlight.orgrest', port=443): Max retries 
exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection 
object at 0x000000070169B1C8>: Failed to establish a new connection: [Errno 11001] getaddrinfo 
failed')

Спасибо.

1 Ответ

0 голосов
/ 08 мая 2020

Попробуйте запустить аннотатор с другим адресом annotate REST API:

annotations = spotlight.annotate('http://api.dbpedia-spotlight.org/en/annotate', document, confidence=0.5, support=20)

...