[~] Refactor
This commit is contained in:
		
							parent
							
								
									11e5dc3b87
								
							
						
					
					
						commit
						12679a907e
					
				@ -303,10 +303,18 @@ def kernel_3(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def kernel_4(
 | 
					def kernel_4(
 | 
				
			||||||
    o_2,
 | 
					    o_2,
 | 
				
			||||||
 | 
					    input_texts=None,
 | 
				
			||||||
):
 | 
					):
 | 
				
			||||||
    import keras.preprocessing.sequence
 | 
					    import keras.preprocessing.sequence
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    t1 = 'blahb blahb blah'
 | 
					    if input_texts is None:
 | 
				
			||||||
 | 
					        input_texts = [
 | 
				
			||||||
 | 
					            'blahb blahb blah'
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    t6 = []
 | 
				
			||||||
 | 
					    for o in input_texts:
 | 
				
			||||||
 | 
					        t1 = o
 | 
				
			||||||
        t2 = o_2['token'].texts_to_sequences(
 | 
					        t2 = o_2['token'].texts_to_sequences(
 | 
				
			||||||
            [t1],
 | 
					            [t1],
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
@ -317,10 +325,17 @@ def kernel_4(
 | 
				
			|||||||
        t4 = o_2['model'].predict(
 | 
					        t4 = o_2['model'].predict(
 | 
				
			||||||
            t3,
 | 
					            t3,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					        t6.append(
 | 
				
			||||||
 | 
					            dict(
 | 
				
			||||||
 | 
					                text=o,
 | 
				
			||||||
 | 
					                score=t4[0],
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return dict(
 | 
					    return dict(
 | 
				
			||||||
        t1=t1,
 | 
					        t1=t1,
 | 
				
			||||||
        t2=t2,
 | 
					        t2=t2,
 | 
				
			||||||
        t3=t3,
 | 
					        t3=t3,
 | 
				
			||||||
        t4=t4,
 | 
					        t4=t4,
 | 
				
			||||||
 | 
					        t6=t6,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user