예제 #1
0
def test_extraction():
    from sematch.nlp import Extraction
    from sematch.sparql import EntityFeatures
    entity_f = EntityFeatures()
    yin_and_yang = entity_f.features('http://dbpedia.org/resource/Yin_and_yang')
    assert yin_and_yang is not None
    extract = Extraction()
    assert 'Chinese' in extract.extract_chunks_doc(yin_and_yang['abstract'])
    assert 'philosophy' in extract.extract_words_doc(yin_and_yang['abstract'])
예제 #2
0
def test_extraction():
    from sematch.nlp import Extraction
    from sematch.sparql import EntityFeatures
    entity_f = EntityFeatures()
    yin_and_yang = entity_f.features(
        'http://dbpedia.org/resource/Yin_and_yang')
    assert yin_and_yang is not None
    extract = Extraction()
    assert 'Chinese' in extract.extract_chunks_doc(yin_and_yang['abstract'])
    assert 'philosophy' in extract.extract_words_doc(yin_and_yang['abstract'])
예제 #3
0
def test_sim_graph():
    from sematch.semantic.graph import SimGraph
    from sematch.semantic.similarity import WordNetSimilarity
    from sematch.nlp import Extraction, lemmatization
    from sematch.sparql import EntityFeatures
    from collections import Counter
    madrid = EntityFeatures().features(
        'http://dbpedia.org/resource/Tom_Cruise')
    words = Extraction().extract_words_sent(madrid['abstract'])
    words = list(set(lemmatization(words)))
    wns = WordNetSimilarity()
    word_graph = SimGraph(words, wns.word_similarity)
    word_scores = word_graph.page_rank()
    words, scores = zip(*Counter(word_scores).most_common(10))
    assert words is not None
예제 #4
0
def test_entity_features():
    from sematch.sparql import EntityFeatures
    entity_f = EntityFeatures()
    yin_and_yang = entity_f.features(
        'http://dbpedia.org/resource/Yin_and_yang')
    print yin_and_yang
예제 #5
0
def test_entity_features():
    from sematch.sparql import EntityFeatures
    entity_f = EntityFeatures()
    yin_and_yang = entity_f.features('http://dbpedia.org/resource/Yin_and_yang')
    print yin_and_yang