mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Merge branch 'develop' of https://github.com/explosion/spaCy into develop
This commit is contained in:
		
						commit
						4fccd2ceaf
					
				| 
						 | 
				
			
			@ -71,6 +71,10 @@ class SentenceRecognizer(Tagger):
 | 
			
		|||
        # are 0
 | 
			
		||||
        return tuple(["I", "S"])
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def label_data(self):
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    def set_annotations(self, docs, batch_tag_ids):
 | 
			
		||||
        """Modify a batch of documents, using pre-computed scores.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
import pytest
 | 
			
		||||
from spacy.language import Language
 | 
			
		||||
from spacy.util import SimpleFrozenList
 | 
			
		||||
from spacy.util import SimpleFrozenList, get_arg_names
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.fixture
 | 
			
		||||
| 
						 | 
				
			
			@ -346,3 +346,34 @@ def test_pipe_methods_frozen():
 | 
			
		|||
        nlp.components.sort()
 | 
			
		||||
    with pytest.raises(NotImplementedError):
 | 
			
		||||
        nlp.component_names.clear()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.parametrize(
 | 
			
		||||
    "pipe",
 | 
			
		||||
    [
 | 
			
		||||
        "tagger",
 | 
			
		||||
        "parser",
 | 
			
		||||
        "ner",
 | 
			
		||||
        "textcat",
 | 
			
		||||
        pytest.param("morphologizer", marks=pytest.mark.xfail),
 | 
			
		||||
    ],
 | 
			
		||||
)
 | 
			
		||||
def test_pipe_label_data_exports_labels(pipe):
 | 
			
		||||
    nlp = Language()
 | 
			
		||||
    pipe = nlp.add_pipe(pipe)
 | 
			
		||||
    # Make sure pipe has pipe labels
 | 
			
		||||
    assert getattr(pipe, "label_data", None) is not None
 | 
			
		||||
    # Make sure pipe can be initialized with labels
 | 
			
		||||
    initialize = getattr(pipe, "initialize", None)
 | 
			
		||||
    assert initialize is not None
 | 
			
		||||
    assert "labels" in get_arg_names(initialize)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.parametrize("pipe", ["senter", "entity_linker"])
 | 
			
		||||
def test_pipe_label_data_no_labels(pipe):
 | 
			
		||||
    nlp = Language()
 | 
			
		||||
    pipe = nlp.add_pipe(pipe)
 | 
			
		||||
    assert getattr(pipe, "label_data", None) is None
 | 
			
		||||
    initialize = getattr(pipe, "initialize", None)
 | 
			
		||||
    if initialize is not None:
 | 
			
		||||
        assert "labels" not in get_arg_names(initialize)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -232,7 +232,7 @@ $ python -m spacy init labels [config_path] [output_path] [--code] [--verbose] [
 | 
			
		|||
| `--gpu-id`, `-g`  | GPU ID or `-1` for CPU. Defaults to `-1`. ~~int (option)~~                                                                                                                                 |
 | 
			
		||||
| `--help`, `-h`    | Show help message and available arguments. ~~bool (flag)~~                                                                                                                                 |
 | 
			
		||||
| overrides         | Config parameters to override. Should be options starting with `--` that correspond to the config section and value to override, e.g. `--paths.train ./train.spacy`. ~~Any (option/flag)~~ |
 | 
			
		||||
| **CREATES**       | The final trained pipeline and the best trained pipeline.                                                                                                                                  |
 | 
			
		||||
| **CREATES**       | The best trained pipeline and the final checkpoint (if training is terminated).                                                                                                            |
 | 
			
		||||
 | 
			
		||||
## convert {#convert tag="command"}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user