mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-30 23:47:31 +03:00 
			
		
		
		
	* Remove old _state imports
This commit is contained in:
		
							parent
							
								
									e9aaecc619
								
							
						
					
					
						commit
						e2f9a80713
					
				
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							|  | @ -152,7 +152,7 @@ MOD_NAMES = ['spacy.parts_of_speech', 'spacy.strings', | |||
|              'spacy.morphology',  | ||||
|              'spacy.syntax.stateclass',  | ||||
|              'spacy._ml', 'spacy.tokenizer', 'spacy.en.attrs', | ||||
|              'spacy.en.pos', 'spacy.syntax.parser', 'spacy.syntax._state', | ||||
|              'spacy.en.pos', 'spacy.syntax.parser',  | ||||
|              'spacy.syntax.transition_system', | ||||
|              'spacy.syntax.arc_eager', 'spacy.syntax._parse_features', | ||||
|              'spacy.gold', 'spacy.orth',  | ||||
|  |  | |||
|  | @ -1,6 +1,5 @@ | |||
| from thinc.typedefs cimport atom_t | ||||
| 
 | ||||
| from ._state cimport State | ||||
| from .stateclass cimport StateClass | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,13 +12,6 @@ from libc.string cimport memset | |||
| from itertools import combinations | ||||
| 
 | ||||
| from ..tokens cimport TokenC | ||||
| from ._state cimport State | ||||
| from ._state cimport get_s2, get_s1, get_s0, get_n0, get_n1, get_n2 | ||||
| from ._state cimport get_p2, get_p1 | ||||
| from ._state cimport get_e0, get_e1 | ||||
| from ._state cimport has_head, get_left, get_right | ||||
| from ._state cimport count_left_kids, count_right_kids | ||||
| 
 | ||||
| 
 | ||||
| from .stateclass cimport StateClass | ||||
| 
 | ||||
|  | @ -58,7 +51,7 @@ cdef inline void fill_token(atom_t* context, const TokenC* token) nogil: | |||
|         # the source that are set to 1. | ||||
|         context[4] = token.lex.cluster & 15 | ||||
|         context[5] = token.lex.cluster & 63 | ||||
|         context[6] = token.dep if has_head(token) else 0 | ||||
|         context[6] = token.dep if token.head != 0 else 0 | ||||
|         context[7] = token.lex.prefix | ||||
|         context[8] = token.lex.suffix | ||||
|         context[9] = token.lex.shape | ||||
|  |  | |||
|  | @ -2,8 +2,6 @@ from cymem.cymem cimport Pool | |||
| 
 | ||||
| from thinc.typedefs cimport weight_t | ||||
| 
 | ||||
| 
 | ||||
| from ._state cimport State | ||||
| from .stateclass cimport StateClass | ||||
| 
 | ||||
| from .transition_system cimport TransitionSystem, Transition | ||||
|  |  | |||
|  | @ -4,13 +4,6 @@ from __future__ import unicode_literals | |||
| import ctypes | ||||
| import os | ||||
| 
 | ||||
| from ._state cimport State | ||||
| from ._state cimport has_head, get_idx, get_s0, get_n0, get_left, get_right | ||||
| from ._state cimport is_final, at_eol, pop_stack, push_stack, add_dep | ||||
| from ._state cimport head_in_buffer, children_in_buffer | ||||
| from ._state cimport head_in_stack, children_in_stack | ||||
| from ._state cimport count_left_kids | ||||
| 
 | ||||
| from ..structs cimport TokenC | ||||
| 
 | ||||
| from .transition_system cimport do_func_t, get_cost_func_t | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ MOVE_NAMES[OUT] = 'O' | |||
| cdef do_func_t[N_MOVES] do_funcs | ||||
| 
 | ||||
| 
 | ||||
| cdef bint _entity_is_sunk(StateClass st, Transition* golds) except -1: | ||||
| cdef bint _entity_is_sunk(StateClass st, Transition* golds) nogil: | ||||
|     if not st.entity_is_open(): | ||||
|         return False | ||||
| 
 | ||||
|  | @ -154,32 +154,32 @@ cdef class BiluoPushDown(TransitionSystem): | |||
| 
 | ||||
| cdef class Missing: | ||||
|     @staticmethod | ||||
|     cdef bint is_valid(StateClass st, int label) except -1: | ||||
|     cdef bint is_valid(StateClass st, int label) nogil: | ||||
|         return False | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int transition(StateClass s, int label) except -1: | ||||
|         raise NotImplementedError | ||||
|     cdef int transition(StateClass s, int label) nogil: | ||||
|         pass | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) nogil: | ||||
|         return 9000 | ||||
| 
 | ||||
| 
 | ||||
| cdef class Begin: | ||||
|     @staticmethod | ||||
|     cdef bint is_valid(StateClass st, int label) except -1: | ||||
|     cdef bint is_valid(StateClass st, int label) nogil: | ||||
|         return label != 0 and not st.entity_is_open() | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int transition(StateClass st, int label) except -1: | ||||
|     cdef int transition(StateClass st, int label) nogil: | ||||
|         st.open_ent(label) | ||||
|         st.set_ent_tag(st.B(0), 3, label) | ||||
|         st.push() | ||||
|         st.pop() | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) nogil: | ||||
|         cdef int g_act = gold.ner[s.B(0)].move | ||||
|         cdef int g_tag = gold.ner[s.B(0)].label | ||||
| 
 | ||||
|  | @ -198,17 +198,17 @@ cdef class Begin: | |||
| 
 | ||||
| cdef class In: | ||||
|     @staticmethod | ||||
|     cdef bint is_valid(StateClass st, int label) except -1: | ||||
|     cdef bint is_valid(StateClass st, int label) nogil: | ||||
|         return st.entity_is_open() and label != 0 and st.E_(0).ent_type == label | ||||
|      | ||||
|     @staticmethod | ||||
|     cdef int transition(StateClass st, int label) except -1: | ||||
|     cdef int transition(StateClass st, int label) nogil: | ||||
|         st.set_ent_tag(st.B(0), 1, label) | ||||
|         st.push() | ||||
|         st.pop() | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) nogil: | ||||
|         move = IN | ||||
|         cdef int next_act = gold.ner[s.B(1)].move if s.B(0) < s.length else OUT | ||||
|         cdef int g_act = gold.ner[s.B(0)].move | ||||
|  | @ -238,17 +238,17 @@ cdef class In: | |||
| 
 | ||||
| cdef class Last: | ||||
|     @staticmethod | ||||
|     cdef bint is_valid(StateClass st, int label) except -1: | ||||
|     cdef bint is_valid(StateClass st, int label) nogil: | ||||
|         return st.entity_is_open() and label != 0 and st.E_(0).ent_type == label | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int transition(StateClass st, int label) except -1: | ||||
|     cdef int transition(StateClass st, int label) nogil: | ||||
|         st.close_ent() | ||||
|         st.push() | ||||
|         st.pop() | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) nogil: | ||||
|         move = LAST | ||||
| 
 | ||||
|         cdef int g_act = gold.ner[s.B(0)].move | ||||
|  | @ -277,11 +277,11 @@ cdef class Last: | |||
| 
 | ||||
| cdef class Unit: | ||||
|     @staticmethod | ||||
|     cdef bint is_valid(StateClass st, int label) except -1: | ||||
|     cdef bint is_valid(StateClass st, int label) nogil: | ||||
|         return label != 0 and not st.entity_is_open() | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int transition(StateClass st, int label) except -1: | ||||
|     cdef int transition(StateClass st, int label) nogil: | ||||
|         st.open_ent(label) | ||||
|         st.close_ent() | ||||
|         st.set_ent_tag(st.B(0), 3, label) | ||||
|  | @ -289,7 +289,7 @@ cdef class Unit: | |||
|         st.pop() | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) nogil: | ||||
|         cdef int g_act = gold.ner[s.B(0)].move | ||||
|         cdef int g_tag = gold.ner[s.B(0)].label | ||||
| 
 | ||||
|  | @ -308,17 +308,17 @@ cdef class Unit: | |||
| 
 | ||||
| cdef class Out: | ||||
|     @staticmethod | ||||
|     cdef bint is_valid(StateClass st, int label) except -1: | ||||
|     cdef bint is_valid(StateClass st, int label) nogil: | ||||
|         return not st.entity_is_open() | ||||
| 
 | ||||
|     @staticmethod | ||||
|     cdef int transition(StateClass st, int label) except -1: | ||||
|     cdef int transition(StateClass st, int label) nogil: | ||||
|         st.set_ent_tag(st.B(0), 2, 0) | ||||
|         st.push() | ||||
|         st.pop() | ||||
|      | ||||
|     @staticmethod | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: | ||||
|     cdef int cost(StateClass s, const GoldParseC* gold, int label) nogil: | ||||
|         cdef int g_act = gold.ner[s.B(0)].move | ||||
|         cdef int g_tag = gold.ner[s.B(0)].label | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user