mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-08-11 11:12:45 +08:00
NER + document classification
This commit is contained in:
@@ -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")
|
||||
Reference in New Issue
Block a user