mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Return Transition for missing actions in lookup_action
This commit is contained in:
		
							parent
							
								
									4a5cc89138
								
							
						
					
					
						commit
						78498a072d
					
				| 
						 | 
					@ -385,6 +385,7 @@ cdef class ArcEager(TransitionSystem):
 | 
				
			||||||
        for i in range(self.n_moves):
 | 
					        for i in range(self.n_moves):
 | 
				
			||||||
            if self.c[i].move == move and self.c[i].label == label:
 | 
					            if self.c[i].move == move and self.c[i].label == label:
 | 
				
			||||||
                return self.c[i]
 | 
					                return self.c[i]
 | 
				
			||||||
 | 
					        return Transition(clas=0, move=MISSING, label=0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def move_name(self, int move, attr_t label):
 | 
					    def move_name(self, int move, attr_t label):
 | 
				
			||||||
        label_str = self.strings[label]
 | 
					        label_str = self.strings[label]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,6 +107,8 @@ cdef class TransitionSystem:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def is_valid(self, StateClass stcls, move_name):
 | 
					    def is_valid(self, StateClass stcls, move_name):
 | 
				
			||||||
        action = self.lookup_transition(move_name)
 | 
					        action = self.lookup_transition(move_name)
 | 
				
			||||||
 | 
					        if action.move == 0:
 | 
				
			||||||
 | 
					            return False
 | 
				
			||||||
        return action.is_valid(stcls.c, action.label)
 | 
					        return action.is_valid(stcls.c, action.label)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef int set_valid(self, int* is_valid, const StateC* st) nogil:
 | 
					    cdef int set_valid(self, int* is_valid, const StateC* st) nogil:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user