DBpedia Spotlight Extractor

class etk.extractors.dbpedia_spotlight_extractor.DBpediaSpotlightExtractor(extractor_name: str, search_url: str, get_attr=False, get_attr_url='http://dbpedia.org/sparql')[source]

Bases: etk.extractor.Extractor

Description
This extractor takes a string of text as input, uses DBPedia API to annotate words and phrases in the text input.

Examples

dbpedia_spotlight_extractor = DBpediaSpotlightExtractor(search_url='http://model.dbpedia-spotlight.org/en/annotate',
                                                        get_attr=False,
                                                        get_attr_url="http://dbpedia.org/sparql")
dbpedia_spotlight_extractor.extract(text=input_doc,
                                    filter=['Person', 'Place', 'Organisation'])
extract(text: str, confidence=0.5, filter=['Person', 'Place', 'Organisation']) → List[etk.extraction.Extraction][source]

Extract with the input text, confidence and fields filter to be used. :param text: text input to be annotated :type text: str :param confidence: the confidence of the annotation :type confidence: float :param filter: the fields that to be extracted :type filter: List[str]

Returns:List[Extraction]