mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-07-09 00:20:23 +08:00
NER + document classification
This commit is contained in:
@@ -20,6 +20,18 @@ class FullAPIRun(unittest.TestCase):
|
||||
self.assertTrue(vector.min() < minimum)
|
||||
self.assertTrue(np.ptp(vector) > span)
|
||||
|
||||
def test_document_classification(self):
|
||||
categories = set(['arts'])
|
||||
text = "On Monday, president Barack Obama will be..."
|
||||
results = classification(text)
|
||||
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):
|
||||
political_set = set(['Libertarian', 'Liberal', 'Conservative', 'Green'])
|
||||
test_string = "Guns don't kill people, people kill people."
|
||||
|
||||
@@ -4,7 +4,8 @@ import os
|
||||
import numpy as np
|
||||
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, named_entities
|
||||
|
||||
DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
@@ -22,6 +23,18 @@ class FullAPIRun(unittest.TestCase):
|
||||
self.assertTrue(vector.min() < minimum)
|
||||
self.assertTrue(np.ptp(vector) > span)
|
||||
|
||||
def test_document_classification(self):
|
||||
categories = set(['arts'])
|
||||
text = "On Monday, president Barack Obama will be..."
|
||||
results = classification(text)
|
||||
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):
|
||||
political_set = set(['Libertarian', 'Liberal', 'Conservative', 'Green'])
|
||||
test_string = "Guns don't kill people, people kill people."
|
||||
|
||||
Reference in New Issue
Block a user