def test_disambiguate_subject_column():
    """

    """
    mlmodel = MLModel()
    table = mlmodel.get_tables()[0]
    entities = disambiguate_subject_column(table)
    import ipdb
    ipdb.set_trace()
示例#2
0
from taipan.entitysearch.agdistis import AgdistisWrapper
from taipan.ml.model import MLModel
from taipan.sparql.propertysearch import *

AGDISTIS = AgdistisWrapper()
MLMODEL = MLModel()

PROPERTIES_0 = {
    0: {
        0: [],
        1: [],
        2: []
    },
    1: {
        0: [],
        1: [],
        2: []
    },
    2: {
        0: [],
        1: [],
        2: []
    }
}

PROPERTIES_1 = {
    0: {
        0: [],
        1: [
            'http://dbpedia.org/property/placeOfDeath',
            'http://dbpedia.org/ontology/populationPlace',
示例#3
0
"""Test for taipan.agdistis"""

from os.path import isfile, join

from taipan.entitysearch.agdistis import AgdistisWrapper
from taipan.ml.model import MLModel
from taipan.generictable import GenericTable

ENTITY = [{'start': 0, 'namedEntity': 'London', 'disambiguatedURL': 'http://dbpedia.org/resource/London', 'offset': 6}]
ROW_ENTITIES = [['http://dbpedia.org/resource/Jeff_Jahn'], [], []]
TO_FLATTEN = [{'start': 0, 'namedEntity': 'EUR', 'disambiguatedURL': 'http://dbpedia.org/resource/EUR,_Rome', 'offset': 3}]
FLATTENED = ['http://dbpedia.org/resource/EUR,_Rome']
TO_FLATTEN_NO_URL = [{'start': 0, 'namedEntity': '35.00', 'disambiguatedURL': None, 'offset': 5}]

agdistis_wrapper = AgdistisWrapper()
mlmodel = MLModel()
table = mlmodel.get_tables()[0]

def test_flatten_urls():
    flattened = agdistis_wrapper.flatten_urls(TO_FLATTEN)
    assert flattened == FLATTENED

    flattened = agdistis_wrapper.flatten_urls(TO_FLATTEN_NO_URL)
    assert flattened == []

def test_disambiguate_entity():
    entity = agdistis_wrapper.disambiguate_entity("London")
    assert entity == ENTITY

def test_disambiguate_table():
    entities = agdistis_wrapper.disambiguate_table(table)
示例#4
0
def test_disambiguate_table_subject_column_only():
    mlmodel = MLModel()
    table = mlmodel.get_tables()[0]
    entities = disambiguate_table_subject_column_only(table)
    assert entities == TABLE_ENTITIES_SC_ONLY
示例#5
0
def test_disambiguate_table():
    mlmodel = MLModel()
    table = mlmodel.get_tables()[0]
    entities = disambiguate_table(table)
    assert entities == TABLE_ENTITIES
示例#6
0
def test_get_support():
    mlmodel = MLModel()
    table = mlmodel.get_tables()[0]
    support = S_CALC.get_support(table)
    assert support == SUPPORT