NER + document classification

This commit is contained in:
Madison May
2014-11-03 15:42:23 -05:00
parent 7feab56a9d
commit ea29884396
8 changed files with 82 additions and 7 deletions
+23
View File
@@ -0,0 +1,23 @@
from indicoio.utils import api_handler
def named_entities(api_root, text):
"""
Given input text, returns a mapping from named entities to
named entity categories.
Example usage:
.. code-block:: python
>>> import indicoio
>>> import numpy as np
>>> text = 'On Monday, president Barack Obama will be...'
>>> indicoio.named_entities(text)
>>> "{'Monday': 'Time', 'Barack Obama': 'Person'}"
:param text: The text to be analyzed.
:type text: str or unicode
:rtype: Dictionary of named entity, category pairs
"""
return api_handler(text, api_root + "ner")