if temp is not None:
                 for pat in temp:
                     pat = CleanPatent(pat)
                     if pat not in ListeBrevetAug and pat != '':
                         if pat['label'] in DejaVu:
                             temporar = [patent for patent in temp if patent['label'] == pat['label']][0] #hum should be unique
                             temporar=UnNest(temporar)
                             for cle in temporar.keys():
                                 temporar[cle] = UnNest(temporar[cle])
                             temporar = CleanPatent(Update(temporar, pat))      
                             temporar = CleanPatent(temporar)
                             ListeBrevetAug.append(temporar)
                             #temp.append(temporar)
                         else:
                             pat = CleanPatent(pat)
                             for cle in pat.keys():
                                 pat[cle] = UnNest(pat[cle])
                             ListeBrevetAug.append(CleanPatent(pat))
                             DejaVu.append(pat['label'])
                     elif pat['label'] in ListeBrevetAug and pat != '':
                         temporar = [patent for patent in ListeBrevetAug if patent['label'] == pat['label']][0] #hum should be unique                  
                         ListeBrevetAug.remove(temporar)
                         temporar = CleanPatent(Update(temporar, pat))
                         temporar = CleanPatent(temporar)        
                         for cle in temporar.keys():
                             temporar[cle] = UnNest(temporar[cle])
                         ListeBrevetAug.append(temporar)
                     
 #            time.sleep(7)
         Done.append(Brev)
         with open(ResultPathFamilies+'//Families'+ ndf, 'w') as ndfLstBrev:
Beispiel #2
0
                        if pat not in ListeBrevetAug and pat != '':
                            if pat['label'] in DejaVu:
                                temporar = [
                                    patent for patent in temp
                                    if patent['label'] == pat['label']
                                ][0]  #hum should be unique
                                temporar = UnNest(temporar)
                                for cle in temporar.keys():
                                    temporar[cle] = UnNest(temporar[cle])
                                temporar = CleanPatent(Update(temporar, pat))
                                temporar = CleanPatent(temporar)
                                ListeBrevetAug.append(temporar)
                                #temp.append(temporar)
                            else:
                                pat = CleanPatent(pat)
                                for cle in pat.keys():
                                    pat[cle] = UnNest(pat[cle])
                                ListeBrevetAug.append(CleanPatent(pat))
                                DejaVu.append(pat['label'])
                        elif pat['label'] in ListeBrevetAug and pat != '':
                            temporar = [
                                patent for patent in ListeBrevetAug
                                if patent['label'] == pat['label']
                            ][0]  #hum should be unique
                            ListeBrevetAug.remove(temporar)
                            temporar = CleanPatent(Update(temporar, pat))
                            temporar = CleanPatent(temporar)
                            for cle in temporar.keys():
                                temporar[cle] = UnNest(temporar[cle])
                            ListeBrevetAug.append(temporar)
        brev[cle] = UnNest(brev[cle])

    brev= CleanPatent(brev)
    brev= CleanPatentOthers2(brev)
    
    ##
    
    tempo = brev # this one for DataTable
    tempo2 = dict() #the one for pitable
    PaysInv= [] #new field
    PaysApp = []
    #tempo = CleanPatent(tempo)
    tempo2 = copy.deepcopy(tempo) #ugly
    tempo3 = dict() #what the problem        
    LstExp.append(tempo)
    for ket in brev.keys():
        tempo3[ket] = tempo[ket]
        if isinstance(tempo2[ket], list):
            tempo2[ket] = UnNest(tempo2[ket])
        else:
            tempo2[ket] = tempo[ket]
        

    clesRef2 = ['label', 'date', 'citations','family lenght', 'priority-active-indicator', 'IPCR4', 'IPCR7', 'portee', 'applicant', 'pays', 'inventeur', 'representative', 'prior', "Inventor-Country", "Applicant-Country"]

    tempoBrev = Decoupe(tempo2)            
    for nb in tempoBrev:
        brev2 = tempoBrev[nb]
        brev2 = CleanPatent(brev2)
        
        
Beispiel #4
0
        brev[cle] = UnNest(brev[cle])

    brev = CleanPatent(brev)
    brev = CleanPatentOthers2(brev)

    ##

    tempo = brev  # this one for DataTable
    tempo2 = dict()  #the one for pitable
    PaysInv = []  #new field
    PaysApp = []
    #tempo = CleanPatent(tempo)
    tempo2 = copy.deepcopy(tempo)  #ugly
    tempo3 = dict()  #what the problem
    LstExp.append(tempo)
    for ket in brev.keys():
        tempo3[ket] = tempo[ket]
        if isinstance(tempo2[ket], list):
            tempo2[ket] = UnNest(tempo2[ket])
        else:
            tempo2[ket] = tempo[ket]

    clesRef2 = [
        'label', 'date', 'citations', 'family lenght',
        'priority-active-indicator', 'IPCR4', 'IPCR7', 'portee', 'applicant',
        'pays', 'inventeur', 'representative', 'prior', "Inventor-Country",
        "Applicant-Country"
    ]

    tempoBrev = Decoupe(tempo2)
    for nb in tempoBrev:
Beispiel #5
0
        print "Found ", data["number"], " patents! Formating to HMTL tables"
    
LstExp = [] 
LstExp2 = [] 
for brev in LstBrevet:
    brev = CleanPatent(brev)
    
    
    tempo = dict() # this one for DataTable
    tempo2 = dict() #the one for pitable
    PaysInv= [] #new field
    PaysApp = []
#    tempo = CleanPatent(brev)
#    brevet= SeparateCountryField(tempo)
    #cleaning classification
    cles = [key for key in brev.keys() if brev[key]==None or brev[key] == [u'None', None] or brev[key] == [None]]
    for cle in cles:
        if cle=='date':
            brev[cle] = unicode(datetime.date.today().year)
        elif cle=="dateDate":
            brev[cle] = datetime.date.today()
        else:
            brev[cle] = u'empty'
    for key in clesRef:
        if key =='inventeur' or key =='applicant':
            if isinstance(brev[key], list):
                tempo[key] = ' '.join(brev[key]).title().strip()
            else:
                tempo[key] = brev[key].title().strip()
        elif key =='titre':
            if isinstance(brev[key], list):