
from pipeline.pipeline import *
from pipeline.entitylinker import *
from pipeline.triplealigner import *
from pipeline.datareader import DBpediaAbstractsDataReader


# Reading the DBpedia Abstracts Dataset
reader = DBpediaAbstractsDataReader('./datasets/wikipedia-abstracts/csv/dbpedia-abstracts.csv', db_wd_mapping='./datasets/wikidata/dbpedia-wikidata-sameas-dict.csv')

# Loading the WikidataSpotlightEntityLinker ... DBpedia Spotlight with mapping DBpedia URIs to Wikidata
link = WikidataSpotlightEntityLinker('./datasets/wikidata/dbpedia-wikidata-sameas-dict.csv', support=1, confidence=0.2)
align = NoSubjectAlign('./datasets/wikidata/sample-wikidata-triples.csv')

for d in reader.read_documents():
    d = link.run(d)
    d = align.run(d)

    print "Document Title: %s \t Number of Annotated Entities %s \t Number of Annotated Triples %s" % (d.title, len(d.entities), len(d.triples))

@@ -1,21 +1,20 @@
-%0A
 from pipeline.pipeli
@@ -157,16 +157,55 @@
 aReader%0A
+from pipeline.writer import JsonWriter%0A
 %0A%0A# Read
@@ -611,16 +611,17 @@
 upport=1
+0
 , confid
@@ -631,9 +631,9 @@
 e=0.
-2
+4
 )%0Aal
@@ -704,17 +704,66 @@
 s.csv')%0A
+writer = JsonWriter('./sample-docs', filesize=10)
 %0A
-
 for d in
@@ -829,16 +829,33 @@
 .run(d)%0A
+    writer.run(d)
 %0A    pri

remove buffer size log