mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-31 07:57:35 +03:00 
			
		
		
		
	Update errors
This commit is contained in:
		
							parent
							
								
									f7e6313b43
								
							
						
					
					
						commit
						e5f47cd82d
					
				|  | @ -239,6 +239,11 @@ class Errors(object): | ||||||
|             "existing extension, set `force=True` on `{obj}.set_extension`.") |             "existing extension, set `force=True` on `{obj}.set_extension`.") | ||||||
|     E091 = ("Invalid extension attribute {name}: expected callable or None, " |     E091 = ("Invalid extension attribute {name}: expected callable or None, " | ||||||
|             "but got: {value}") |             "but got: {value}") | ||||||
|  |     E092 = ("Could not find or assign name for word vectors. Ususally, the " | ||||||
|  |             "name is read from the model's meta.json in vector.name. " | ||||||
|  |             "Alternatively, it is built from the 'lang' and 'name' keys in " | ||||||
|  |             "the meta.json. Vector names are required to avoid issue #1660.") | ||||||
|  |     E093 = ("token.ent_iob values make invalid sequence: I without B\n{seq}") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @add_codes | @add_codes | ||||||
|  | @ -252,6 +257,10 @@ class TempErrors(object): | ||||||
|     T006 = ("Currently history width is hard-coded to 0. Received: {value}.") |     T006 = ("Currently history width is hard-coded to 0. Received: {value}.") | ||||||
|     T007 = ("Can't yet set {attr} from Span. Vote for this feature on the " |     T007 = ("Can't yet set {attr} from Span. Vote for this feature on the " | ||||||
|             "issue tracker: http://github.com/explosion/spaCy/issues") |             "issue tracker: http://github.com/explosion/spaCy/issues") | ||||||
|  |     T008 = ("Bad configuration of Tagger. This is probably a bug within " | ||||||
|  |             "spaCy. We changed the name of an internal attribute for loading " | ||||||
|  |             "pre-trained vectors, and the class has been passed the old name " | ||||||
|  |             "(pretrained_dims) but not the new name (pretrained_vectors).") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class ModelsWarning(UserWarning): | class ModelsWarning(UserWarning): | ||||||
|  |  | ||||||
|  | @ -707,7 +707,7 @@ def _fix_pretrained_vectors_name(nlp): | ||||||
|         vectors_name = '%s_%s.vectors' % (nlp.meta['lang'], nlp.meta['name']) |         vectors_name = '%s_%s.vectors' % (nlp.meta['lang'], nlp.meta['name']) | ||||||
|         nlp.vocab.vectors.name = vectors_name |         nlp.vocab.vectors.name = vectors_name | ||||||
|     else: |     else: | ||||||
|         raise ValueError("Unnamed vectors") |         raise ValueError(Errors.E092) | ||||||
|     for name, proc in nlp.pipeline: |     for name, proc in nlp.pipeline: | ||||||
|         if not hasattr(proc, 'cfg'): |         if not hasattr(proc, 'cfg'): | ||||||
|             continue |             continue | ||||||
|  |  | ||||||
|  | @ -531,12 +531,7 @@ class Tagger(Pipe): | ||||||
|     @classmethod |     @classmethod | ||||||
|     def Model(cls, n_tags, **cfg): |     def Model(cls, n_tags, **cfg): | ||||||
|         if cfg.get('pretrained_dims') and not cfg.get('pretrained_vectors'): |         if cfg.get('pretrained_dims') and not cfg.get('pretrained_vectors'): | ||||||
|             raise ValueError( |             raise ValueError(TempErrors.T008) | ||||||
|                 "Bad configuration of Tagger --- this is probably a bug " |  | ||||||
|                 "within spaCy. We changed the name of an internal attribute " |  | ||||||
|                 "for loading pre-trained vectors, and the class has been " |  | ||||||
|                 "passed the old name (pretrained_dims) but not the new name " |  | ||||||
|                 "(pretrained_vectors)") |  | ||||||
|         return build_tagger_model(n_tags, **cfg) |         return build_tagger_model(n_tags, **cfg) | ||||||
| 
 | 
 | ||||||
|     def add_label(self, label, values=None): |     def add_label(self, label, values=None): | ||||||
|  |  | ||||||
|  | @ -430,10 +430,7 @@ cdef class Doc: | ||||||
|                 if token.ent_iob == 1: |                 if token.ent_iob == 1: | ||||||
|                     if start == -1: |                     if start == -1: | ||||||
|                         seq = ['%s|%s' % (t.text, t.ent_iob_) for t in self[i-5:i+5]] |                         seq = ['%s|%s' % (t.text, t.ent_iob_) for t in self[i-5:i+5]] | ||||||
|                         raise ValueError( |                         raise ValueError(Errors.E093.format(seq=' '.join(seq))) | ||||||
|                             "token.ent_iob values make invalid sequence: " |  | ||||||
|                             "I without B\n" |  | ||||||
|                             "{seq}".format(seq=' '.join(seq))) |  | ||||||
|                 elif token.ent_iob == 2 or token.ent_iob == 0: |                 elif token.ent_iob == 2 or token.ent_iob == 0: | ||||||
|                     if start != -1: |                     if start != -1: | ||||||
|                         output.append(Span(self, start, i, label=label)) |                         output.append(Span(self, start, i, label=label)) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user