mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-08-18 11:40:35 +08:00
Remove ner
This commit is contained in:
@@ -9,7 +9,6 @@ from indicoio.text.sentiment import political, posneg
|
|||||||
from indicoio.text.sentiment import posneg as sentiment
|
from indicoio.text.sentiment import posneg as sentiment
|
||||||
from indicoio.text.lang import language
|
from indicoio.text.lang import language
|
||||||
from indicoio.text.classification import classification
|
from indicoio.text.classification import classification
|
||||||
from indicoio.text.ner import named_entities
|
|
||||||
from indicoio.images.fer import fer
|
from indicoio.images.fer import fer
|
||||||
from indicoio.images.features import facial_features
|
from indicoio.images.features import facial_features
|
||||||
from indicoio.images.features import image_features
|
from indicoio.images.features import image_features
|
||||||
@@ -23,4 +22,3 @@ fer = partial(fer, config.api_root)
|
|||||||
facial_features = partial(facial_features, config.api_root)
|
facial_features = partial(facial_features, config.api_root)
|
||||||
image_features = partial(image_features, config.api_root)
|
image_features = partial(image_features, config.api_root)
|
||||||
classification = partial(classification, config.api_root)
|
classification = partial(classification, config.api_root)
|
||||||
named_entities = partial(named_entities, config.api_root)
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ from indicoio.text.sentiment import political, posneg
|
|||||||
from indicoio.text.sentiment import posneg as sentiment
|
from indicoio.text.sentiment import posneg as sentiment
|
||||||
from indicoio.text.lang import language
|
from indicoio.text.lang import language
|
||||||
from indicoio.text.classification import classification
|
from indicoio.text.classification import classification
|
||||||
from indicoio.text.ner import named_entities
|
|
||||||
from indicoio.images.fer import fer
|
from indicoio.images.fer import fer
|
||||||
from indicoio.images.features import facial_features
|
from indicoio.images.features import facial_features
|
||||||
from indicoio.images.features import image_features
|
from indicoio.images.features import image_features
|
||||||
@@ -21,4 +20,3 @@ fer = partial(fer, config.local_api_root)
|
|||||||
facial_features = partial(facial_features, config.local_api_root)
|
facial_features = partial(facial_features, config.local_api_root)
|
||||||
image_features = partial(image_features, config.local_api_root)
|
image_features = partial(image_features, config.local_api_root)
|
||||||
classification = partial(classification, config.local_api_root)
|
classification = partial(classification, config.local_api_root)
|
||||||
named_entities = partial(named_entities, config.local_api_root)
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
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")
|
|
||||||
@@ -26,12 +26,6 @@ class FullAPIRun(unittest.TestCase):
|
|||||||
results = classification(text)
|
results = classification(text)
|
||||||
self.assertTrue(categories < set(results.keys()))
|
self.assertTrue(categories < set(results.keys()))
|
||||||
|
|
||||||
def test_named_entity_recognition(self):
|
|
||||||
categories = set(['arts'])
|
|
||||||
text = "On Monday, president Barack Obama will be..."
|
|
||||||
results = named_entities(text)
|
|
||||||
self.assertTrue('named entity' in set(results.keys()))
|
|
||||||
|
|
||||||
def test_political(self):
|
def test_political(self):
|
||||||
political_set = set(['Libertarian', 'Liberal', 'Conservative', 'Green'])
|
political_set = set(['Libertarian', 'Liberal', 'Conservative', 'Green'])
|
||||||
test_string = "Guns don't kill people, people kill people."
|
test_string = "Guns don't kill people, people kill people."
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import os
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import skimage.io
|
import skimage.io
|
||||||
|
|
||||||
from indicoio import political, sentiment, fer, facial_features, language, image_features, \
|
from indicoio import political, sentiment, fer, facial_features, language, image_features, classification
|
||||||
classification, named_entities
|
|
||||||
|
|
||||||
DIR = os.path.dirname(os.path.realpath(__file__))
|
DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
@@ -29,12 +28,6 @@ class FullAPIRun(unittest.TestCase):
|
|||||||
results = classification(text)
|
results = classification(text)
|
||||||
self.assertTrue(categories < set(results.keys()))
|
self.assertTrue(categories < set(results.keys()))
|
||||||
|
|
||||||
def test_named_entity_recognition(self):
|
|
||||||
categories = set(['arts'])
|
|
||||||
text = "On Monday, president Barack Obama will be..."
|
|
||||||
results = named_entities(text)
|
|
||||||
self.assertTrue('named entity' in set(results.keys()))
|
|
||||||
|
|
||||||
def test_political(self):
|
def test_political(self):
|
||||||
political_set = set(['Libertarian', 'Liberal', 'Conservative', 'Green'])
|
political_set = set(['Libertarian', 'Liberal', 'Conservative', 'Green'])
|
||||||
test_string = "Guns don't kill people, people kill people."
|
test_string = "Guns don't kill people, people kill people."
|
||||||
|
|||||||
Reference in New Issue
Block a user