mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	* Fix token.conjuncts
This commit is contained in:
		
							parent
							
								
									b8f3345a82
								
							
						
					
					
						commit
						2e0104ac81
					
				| 
						 | 
					@ -250,20 +250,14 @@ cdef class Token:
 | 
				
			||||||
        def __get__(self):
 | 
					        def __get__(self):
 | 
				
			||||||
            """Get a list of conjoined words."""
 | 
					            """Get a list of conjoined words."""
 | 
				
			||||||
            cdef Token word
 | 
					            cdef Token word
 | 
				
			||||||
            conjs = [self]
 | 
					            conjuncts = []
 | 
				
			||||||
            if self.c.pos != CONJ and self.c.pos != PUNCT:
 | 
					            if self.c.pos != CONJ and self.c.pos != PUNCT:
 | 
				
			||||||
                seen_conj = False
 | 
					 | 
				
			||||||
                for word in self.rights:
 | 
					                for word in self.rights:
 | 
				
			||||||
                    if word.c.pos == CONJ:
 | 
					                    if word.dep_ == 'conj':
 | 
				
			||||||
                        seen_conj = True
 | 
					                        yield word
 | 
				
			||||||
                    elif seen_conj and word.c.pos == self.c.pos:
 | 
					                        yield from word.conjuncts
 | 
				
			||||||
                        conjs.append(word)
 | 
					                        conjuncts.append(word)
 | 
				
			||||||
            if seen_conj:
 | 
					                        conjuncts.extend(word.conjuncts)
 | 
				
			||||||
                return conjs
 | 
					 | 
				
			||||||
            elif self is not self.head and self in self.head.conjuncts:
 | 
					 | 
				
			||||||
                return self.head.conjuncts
 | 
					 | 
				
			||||||
            else:
 | 
					 | 
				
			||||||
                return []
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    property ent_type:
 | 
					    property ent_type:
 | 
				
			||||||
        def __get__(self):
 | 
					        def __get__(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user