(component_name)
| 713 | |
| 714 | @pytest.mark.parametrize("component_name", ["ner", "textcat", "spancat", "tagger"]) |
| 715 | def test_init_labels(component_name): |
| 716 | nlp = Dutch() |
| 717 | component = nlp.add_pipe(component_name) |
| 718 | for label in ["T1", "T2", "T3", "T4"]: |
| 719 | component.add_label(label) |
| 720 | assert len(nlp.get_pipe(component_name).labels) == 4 |
| 721 | |
| 722 | with make_tempdir() as tmp_dir: |
| 723 | _init_labels(nlp, tmp_dir) |
| 724 | |
| 725 | config = init_config( |
| 726 | lang="nl", |
| 727 | pipeline=[component_name], |
| 728 | optimize="efficiency", |
| 729 | gpu=False, |
| 730 | ) |
| 731 | config["initialize"]["components"][component_name] = { |
| 732 | "labels": { |
| 733 | "@readers": "spacy.read_labels.v1", |
| 734 | "path": f"{tmp_dir}/{component_name}.json", |
| 735 | } |
| 736 | } |
| 737 | |
| 738 | nlp2 = load_model_from_config(config, auto_fill=True) |
| 739 | assert len(nlp2.get_pipe(component_name).labels) == 0 |
| 740 | nlp2.initialize() |
| 741 | assert len(nlp2.get_pipe(component_name).labels) == 4 |
| 742 | |
| 743 | |
| 744 | def test_get_third_party_dependencies(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…