Beispiel #1
0
        type="choice",
        choices=["sdrt", "pdtb", "minsdrt", "subord_coord"],
        help="merge classes according to given relation grouping (cf doc)")

    (options, args) = parser.parse_args()

    allfuncs = {}
    if options.timex:
        allfuncs["timex"] = add_timex
    if options.anaphor:
        allfuncs["anaph"] = add_anaph_feats
    if options.verb_class:
        allfuncs["verb"] = add_verbclass
    if options.voisins and LEX:
        #allfuncs["voisins"] = add_voisins
        db_filename, table = init_voisins(options.voisins)
        allfuncs["voisins"] = edu_similarity
    if options.relations:
        allfuncs["relations"] = add_relations

    if (options.simple or options.strand_orphans) and allfuncs == {}:
        allfuncs["dummy"] = add_nothing

    print >> sys.stderr, "Requested additions:", allfuncs.keys()

    # basename = args[0]
    # doc      = annodisAnnot(basename+".xml")
    # feats    = FeatureMap(basename+".features")
    # prep     = Preprocess( basename+".txt.prep.xml")

    if options.merge:
Beispiel #2
0
if __name__=="__main__":
    test=sys.argv[1]
    
    try:
        doc=annodisAnnot(test)
        #print doc.text().encode("utf8")
        #print doc.get_edu("2").attrib
        #print doc.get_edu_text("1")
    except:
        print >> sys.stderr, "pb reading", test
    try:
        prep=Preprocess(test.split(".xml")[0]+".txt.prep.xml")
        doc.add_preprocess(prep) 
        voisins = sys.argv[2]
	db_filename,table=init_voisins(voisins)
	corpus.add_lexical_relations(table)
        
	# for pid,p in doc.parses().items():
        #     print p.dependencies()
        # for i in range(10):
        #     print "Mentions for EDU %s: %s" %(i,doc.get_edu_mentions( str(i) ))
        mentions = doc.mentions().values()
        #mentions.sort()
        # PM: commented out for speed
        #for m in mentions:
        #    print m
        for i in range(1,10):
            try:
                print i, doc.get_edu_text( str(i) ).encode("utf8")
                print i, doc.get_edu_mentions( str(i) )
Beispiel #3
0
if __name__ == "__main__":
    test = sys.argv[1]

    try:
        doc = annodisAnnot(test)
        #print doc.text().encode("utf8")
        #print doc.get_edu("2").attrib
        #print doc.get_edu_text("1")
    except:
        print >> sys.stderr, "pb reading", test
    try:
        prep = Preprocess(test.split(".xml")[0] + ".txt.prep.xml")
        doc.add_preprocess(prep)
        voisins = sys.argv[2]
        db_filename, table = init_voisins(voisins)
        corpus.add_lexical_relations(table)

        # for pid,p in doc.parses().items():
        #     print p.dependencies()
        # for i in range(10):
        #     print "Mentions for EDU %s: %s" %(i,doc.get_edu_mentions( str(i) ))
        mentions = doc.mentions().values()
        #mentions.sort()
        # PM: commented out for speed
        #for m in mentions:
        #    print m
        for i in range(1, 10):
            try:
                print i, doc.get_edu_text(str(i)).encode("utf8")
                print i, doc.get_edu_mentions(str(i))
Beispiel #4
0
    (options, args) = parser.parse_args()




    allfuncs = {}
    if options.timex:
        allfuncs["timex"] = add_timex
    if options.anaphor:
        allfuncs["anaph"] = add_anaph_feats
    if options.verb_class:
        allfuncs["verb"] = add_verbclass
    if options.voisins and LEX:
        #allfuncs["voisins"] = add_voisins
        db_filename, table = init_voisins(options.voisins)
        allfuncs["voisins"] = edu_similarity
    if options.relations:
        allfuncs["relations"] = add_relations

    if (options.simple or options.strand_orphans) and allfuncs == {}:
        allfuncs["dummy"] = add_nothing

    print >> sys.stderr, "Requested additions:", allfuncs.keys()

    # basename = args[0]
    # doc      = annodisAnnot(basename+".xml")
    # feats    = FeatureMap(basename+".features")
    # prep     = Preprocess( basename+".txt.prep.xml")

    if options.merge: