예제 #1
0
def process_sentences(usr, rcts_impo, no_cache):
    no_cache = True
    purps = get_aliases_p(rcts_impo)
    print 'Purps:', purps
    print 'NO_cache:', no_cache
    if no_cache:
        for pur_p in purps:
            print 'Collect ractionlines for(1):', pur_p, '-----'
            ractionlines = mdOntology.mdAbstractBaseOntology()
            ractionlines.nodesER = rcts_impo
            print 'Found:', len(
                ractionlines.nodesER), '-> Ready to start inference-engine:'
            #===============
            process_termo(rcts_impo, usr, pur_p, ractionlines)
예제 #2
0
def process_sentences(usr,rcts_impo): 
 #   
 purps=get_aliases_p( rcts_impo )
 print 'Purps:',purps
 for pur_p in purps:
     aliases=get_aliases_ob ()
     layers=[]
     layers2=[]
     layers=get_ontology(aliases,pur_p,usr)
     nms=[]
     for dks in layers:
      for dk1 in dks:
       for dk in dk1:
        nms.append(dk.name)
     print 'GetLayers:(',aliases,',',pur_p,')->',(layers),'{',nms,'}'

     #===============
     #======== load ractionlines baseado no cenario escolhido => parametro de linha de comando purpose
     print 'Collect ractionlines for(1):',pur_p,'-----'
     ractionlines=mdOntology.mdAbstractBaseOntology ()
     ractionlines.nodesER=rcts_impo
     print 'Found:',len(ractionlines.nodesER),'-> Ready to start inference-engine:'
     #===============
     print 'OBJS:',aliases,' Result:',layers
     if len(layers)>0:
      print 'Start process of rct:-------------------------'
      # doc
      print 'Process layers:',len(layers)
      for doc in layers:
       #sente
       print 'Process doc:',len(doc)
       for sentece in doc:
         #lines
         print 'Process Sentence:',len(sentece)
         ids=0
         try:
          for s in sentece:
           ids+=1
           #print s.name,'---',ids
          print 'AK-sentence:[',sentece,']' 
          process_termo(sentece,usr,pur_p,ractionlines)
         except Exception,ess1:
          print 'Error process termo:',ess1
          log.exception( '===========================' )
     else: 
       process_termo([],usr,pur_p,ractionlines)      
     #===============
     '''
예제 #3
0
def process_sentences(usr, rcts_impo):
    purps = ret_usr_inter(usr)
    for pur_p in purps:
        aliases = get_aliases_ob()
        layers = []
        layers = get_ontology(aliases, pur_p, usr)
        print 'GetLayers:(', aliases, ',', pur_p, ')->', len(layers)
        layers2 = get_ontology2(aliases, pur_p, usr)
        print 'GetLayers2:(', aliases, ',', pur_p, ')->', len(layers2)
        #===============
        #======== load ractionlines baseado no cenario escolhido => parametro de linha de comando purpose
        print 'Collect ractionlines for(1):', pur_p, '-----'
        ractionlines = mdOntology.mdAbstractBaseOntology()
        ractionlines.nodesER = rcts_impo
        print 'Found:', len(
            ractionlines.nodesER), '-> Ready to start inference-engine:'
        #===============
        print 'OBJS:', aliases, ' Result:', layers
        if len(layers) > 0:
            print 'Start process of rct:-------------------------'
            # doc
            print 'Process layers:', len(layers)
            for doc in layers:
                #sente
                print 'Process doc:', len(doc)
                for sentece in doc:
                    #lines
                    print 'Process Sentence:', len(sentece)
                    ids = 0
                    try:
                        for s in sentece:
                            ids += 1
                            #print s.name,'---',ids

                        process_termo(sentece, usr, pur_p, ractionlines)
                    except Exception, ess1:
                        print 'Error process termo:', ess1
        #===============
        print 'OBJS Rels:', aliases, ' Result:', layers2
        if len(layers2) > 0:
            print 'Start process of rct:-------------------------'
            # doc
            for doc in layers2:
                #sente
                for sentece in doc:
                    #lines
                    process_termo(sentece, usr, pur_p, ractionlines, True)
예제 #4
0
def process_sentences2(usr,rcts_impo,layers_param): 
 #purps=ret_usr_inter(usr)  
 purps=get_aliases_p( rcts_impo )
 print 'Purps:',purps
 for pur_p in purps:
     aliases=get_aliases_ob ()
     layers=[]
     layers2=[]
     #======== load ractionlines baseado no cenario escolhido => parametro de linha de comando purpose
     print 'Collect ractionlines for(1):',pur_p,'-----'
     ractionlines=mdOntology.mdAbstractBaseOntology ()
     ractionlines.nodesER=rcts_impo
     print 'Found:',len(ractionlines.nodesER),'-> Ready to start inference-engine:'
     #===============
     print 'OBJS:',aliases,' Result:',layers
     if True :
         try:          
          process_termo(layers_param,usr,pur_p,ractionlines)
         except Exception,ess1:
          log.exception( '===========================' )
          print 'Error process termo:',ess1