This plugin integrates some of Apache Stanbol's features into your WordPress blog.
- Generate links to Wikipedia articles automatically
- Generate maps with locations mentioned in the post
- Provide useful background information when writing your blog post
- Auto-tag your posts
- Download plugin and copy to your plugin directory (usually this is
/wp-content/plugins
) - Set up your Stanbol instance to have an enhancement engine with at least:
- One NER engine (tested with OpenNLP NER)
- DBpedia Linking
- DBpedia Dereferencing
- A language detection engine
- Open config.php, define:
- STANBOL_INSTANCE to the correct HTTP endpoint (previously defined in step 2)
- GOOGLE_MAPS_API_KEY to your Google Maps API key (get one at Google's API console)
- Have a look at the other settings as well.
Apart from being a plugin for WordPress, this project also offers a library, which queries an Apache Stanbol instance from PHP. You can use this to access Stanbol from within PHP. It's MIT licensed.
$text = "The Stanbol enhancer can detect famous cities such as Paris " +
"and people such as Bob Marley.";
// enhance text
$enhancer = new Wordbol\Enhancer();
$result = $enhancer->enhance($text);
This will issue an asynchronous request to your configured Stanbol instance.
// retrieve language
$language = $result->get_languages();
/*
$language = array(
LanguageEnhancement("en", confidence = 100%)
)
*/
// retrieve matched entities
$entities = $result->get_entity_annotations();
/*
$entities = EntityStorage(
TextAnnotation("Merkel", start = 50, end = 56) =>
array(
Entity("http://dbpedia.org/page/Angela_Merkel",
EntityType::Person, confidence = 90%),
Entity("http://dbpedia.org/page/Merkel,_Texas",
EntityType::Place, confidence = 30%)
),
TextAnnotation("Barack Obama", start = 100, end = 112) =>
array(
Entity("http://dbpedia.org/page/Barack_Obama",
EntityType::Person, confidence = 100%)
)
)
*/
// retrieve special information about an entity
$info = $result->get_resource_info("http://dbpedia.org/page/Angela_Merkel");
/*
$info = array(
"comment" => "Angela Dorothea Merkel,; née Kasner (born 17 July 1954) is the Chancellor of Germany and Chairwoman of the Christian Democratic Union (CDU) [...]",
"depiction" => "http://upload.wikimedia.org/wikipedia/commons/2/2e/Angela_Merkel_2_Hamburg.jpg"
)
*/