def test_text_returns_entities():
    text = "Holmes and Watson walked to the cafe."
    text_analyzer = main.TextAnalyzer()
    entities = text_analyzer.nl_detect(text)
    assert entities
    etype, ename, salience, wurl = text_analyzer.extract_entity_info(
        entities[0])
    assert ename == 'holmes'
示例#2
0
def test_text_returns_entities():
    text = "Holmes and Watson walked to the cafe."
    text_analyzer = main.TextAnalyzer()
    entities = text_analyzer.nl_detect(text)
    assert len(entities) == 2
    etype, ename, salience, wurl = text_analyzer.extract_entity_info(
        entities[0])
    assert ename == 'holmes'
    assert wurl == 'http://en.wikipedia.org/wiki/Sherlock_Holmes'
def test_entities_list():
    vision_api_client = main.VisionApi()
    image_path = TEST_IMAGE_URI
    texts = vision_api_client.detect_text([image_path])
    locale, document = main.extract_description(texts[image_path])
    text_analyzer = main.TextAnalyzer()
    entities = text_analyzer.nl_detect(document)
    assert entities
    etype, ename, salience, wurl = text_analyzer.extract_entity_info(
        entities[0])
    assert ename == 'bennet'
示例#4
0
def test_entities_list(cloud_config):
    vision_api_client = main.VisionApi()
    image_path = _TEST_IMAGE_URI.format(cloud_config.storage_bucket)
    texts = vision_api_client.detect_text([image_path])
    locale, document = main.extract_description(texts[image_path])
    text_analyzer = main.TextAnalyzer()
    entities = text_analyzer.nl_detect(document)
    assert len(entities) == 4
    etype, ename, salience, wurl = text_analyzer.extract_entity_info(
        entities[0])
    assert ename == 'bennet'
    assert wurl == 'http://en.wikipedia.org/wiki/Mr_Bennet'