From 92f1b8cdb44d1dc5ddee7320ad85ef8c0cca5742 Mon Sep 17 00:00:00 2001 From: BLKSerene Date: Mon, 26 May 2025 22:03:49 +0800 Subject: [PATCH 1/4] Switch to typer-slim (#13759) --- requirements.txt | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4f4383300..e55d25a19 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ murmurhash>=0.28.0,<1.1.0 wasabi>=0.9.1,<1.2.0 srsly>=2.4.3,<3.0.0 catalogue>=2.0.6,<2.1.0 -typer>=0.3.0,<1.0.0 +typer-slim>=0.3.0,<1.0.0 weasel>=0.1.0,<0.5.0 # Third party dependencies numpy>=2.0.0,<3.0.0 diff --git a/setup.cfg b/setup.cfg index bc7b6e9d7..f00b5408e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,7 +55,7 @@ install_requires = catalogue>=2.0.6,<2.1.0 weasel>=0.1.0,<0.5.0 # Third-party dependencies - typer>=0.3.0,<1.0.0 + typer-slim>=0.3.0,<1.0.0 tqdm>=4.38.0,<5.0.0 numpy>=1.15.0; python_version < "3.9" numpy>=1.19.0; python_version >= "3.9" From b205ff65e68ca173579837818bdf740245d6aa30 Mon Sep 17 00:00:00 2001 From: omahs <73983677+omahs@users.noreply.github.com> Date: Mon, 26 May 2025 16:05:29 +0200 Subject: [PATCH 2/4] fix typos (#13813) --- spacy/cli/debug_model.py | 2 +- spacy/tests/pipeline/test_textcat.py | 2 +- spacy/tests/test_language.py | 2 +- website/docs/api/cython.mdx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spacy/cli/debug_model.py b/spacy/cli/debug_model.py index 8a0fd4889..3c667e42a 100644 --- a/spacy/cli/debug_model.py +++ b/spacy/cli/debug_model.py @@ -170,7 +170,7 @@ def debug_model( msg.divider(f"STEP 3 - prediction") msg.info(str(prediction)) - msg.good(f"Succesfully ended analysis - model looks good.") + msg.good(f"Successfully ended analysis - model looks good.") def _sentences(): diff --git a/spacy/tests/pipeline/test_textcat.py b/spacy/tests/pipeline/test_textcat.py index 8a0c1a976..8e4a5ed7c 100644 --- a/spacy/tests/pipeline/test_textcat.py +++ b/spacy/tests/pipeline/test_textcat.py @@ -260,7 +260,7 @@ labels = ['label1', 'label2'] ) @pytest.mark.issue(6908) def test_issue6908(component_name): - """Test intializing textcat with labels in a list""" + """Test initializing textcat with labels in a list""" def create_data(out_file): nlp = spacy.blank("en") diff --git a/spacy/tests/test_language.py b/spacy/tests/test_language.py index ee707f793..f946528ae 100644 --- a/spacy/tests/test_language.py +++ b/spacy/tests/test_language.py @@ -740,7 +740,7 @@ def test_pass_doc_to_pipeline(nlp, n_process): assert len(doc.cats) > 0 if isinstance(get_current_ops(), NumpyOps) or n_process < 2: # Catch warnings to ensure that all worker processes exited - # succesfully. + # successfully. with warnings.catch_warnings(): warnings.simplefilter("error") docs = nlp.pipe(docs, n_process=n_process) diff --git a/website/docs/api/cython.mdx b/website/docs/api/cython.mdx index 764ff10f4..5f744eeb6 100644 --- a/website/docs/api/cython.mdx +++ b/website/docs/api/cython.mdx @@ -32,7 +32,7 @@ we use all four in different places, as they all have different utility: The most important classes in spaCy are defined as `cdef class` objects. The underlying data for these objects is usually gathered into a struct, which is -usually named `c`. For instance, the [`Lexeme`](/api/cython-classses#lexeme) +usually named `c`. For instance, the [`Lexeme`](/api/cython-classes#lexeme) class holds a [`LexemeC`](/api/cython-structs#lexemec) struct, at `Lexeme.c`. This lets you shed the Python container, and pass a pointer to the underlying data into C-level functions. From 46613e27cf59357720333195db5729147eecee9b Mon Sep 17 00:00:00 2001 From: d0ngw Date: Tue, 27 May 2025 07:20:26 +0800 Subject: [PATCH 3/4] fix: match hyphenated words to lemmas in index_table (e.g. "co-authored" -> "co-author") (#13816) --- spacy/pipeline/lemmatizer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/pipeline/lemmatizer.py b/spacy/pipeline/lemmatizer.py index c08d59a3b..26867b473 100644 --- a/spacy/pipeline/lemmatizer.py +++ b/spacy/pipeline/lemmatizer.py @@ -218,7 +218,10 @@ class Lemmatizer(Pipe): if not form: pass elif form in index or not form.isalpha(): - forms.append(form) + if form in index: + forms.insert(0, form) + else: + forms.append(form) else: oov_forms.append(form) # Remove duplicates but preserve the ordering of applied "rules" From bec546cec0aac4f344b739e266a5bcb93399ba64 Mon Sep 17 00:00:00 2001 From: Ilie <40547052+iliedorobat@users.noreply.github.com> Date: Tue, 27 May 2025 02:21:07 +0300 Subject: [PATCH 4/4] Add TeNs plugin (#13800) Co-authored-by: Ilie Cristian Dorobat --- website/meta/universe.json | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/website/meta/universe.json b/website/meta/universe.json index f379ea87b..b7842bddc 100644 --- a/website/meta/universe.json +++ b/website/meta/universe.json @@ -1,5 +1,74 @@ { "resources": [ + { + "id": "TeNs", + "title": "Temporal Expressions Normalization spaCy", + "thumb": "https://github-production-user-asset-6210df.s3.amazonaws.com/40547052/433595900-fae3c9d9-7181-4d8b-8b49-e6dc4fca930b.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20250414%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250414T235545Z&X-Amz-Expires=300&X-Amz-Signature=e21d3c06300ceb15fa1dadd7cb60081cc9f1b35e5a7bfd07f6e8b90dd7fad9d0&X-Amz-SignedHeaders=host", + "url": "https://pypi.org/project/temporal-normalization-spacy/", + "slogan": "A temporal expression normalization plugin for Romanian using rule-based methods and DBpedia mappings.", + "description": "**[Temporal Expressions Normalization spaCy (TeNs)](https://github.com/iliedorobat/timespan-normalization-spacy)** is a powerful pipeline component for spaCy that seamlessly identifies and parses date entities in text. It leverages the **[Temporal Expressions Normalization Framework]( https://github.com/iliedorobat/timespan-normalization)** to recognize a wide variety of date formats using an extensive set of regular expressions (RegEx), ensuring robust and adaptable date extraction across diverse textual sources.\n\nUnlike conventional solutions that primarily focus on well-structured date formats, TeNs excels in handling real-world text by **identifying** not only standard date representations but also **abbreviated, informal, or even misspelled temporal expressions.** This makes it particularly effective for processing noisy or unstructured data, such as historical records, user-generated content, and scanned documents with OCR inaccuracies.", + "github": "iliedorobat/timespan-normalization-spacy", + "pip": "temporal-normalization-spacy", + "code_example": [ + "import subprocess", + "", + "import spacy", + "", + "from temporal_normalization.commons.print_utils import console", + "from temporal_normalization.index import create_normalized_component, TemporalNormalization # noqa: F401", + "", + "", + "try:", + " # Load the spaCy model if it has already been downloaded", + " nlp = spacy.load('ro_core_news_sm')", + "except OSError:", + " console.warning(f'Started downloading ro_core_news_sm...')", + " # Download the Romanian model if it wasn't already downloaded", + " subprocess.run(['python', '-m', 'spacy', 'download', 'ro_core_news_sm'])", + " # Load the spaCy model", + " nlp = spacy.load('ro_core_news_sm')", + "", + "# Add 'temporal_normalization' component to the spaCy pipeline", + "nlp.add_pipe('temporal_normalization', last=True)", + "doc = nlp('Sec al II-lea a.ch. - I d.ch reprezintă o perioadă de mari schimbări.')", + "", + "# Display information about the identified and normalized dates in the text.", + "for entity in doc.ents:", + " edges = entity._.time_series.edges", + "", + " print('Start Edge:')", + " print(edges.start.serialize('\\t'))", + " print()", + "", + " print('End Edge:')", + " print(edges.end.serialize('\\t'))", + " print()", + "", + " print('Periods:')", + " for period in entity._.time_series.periods:", + " print(period.serialize('\\t'))", + " print()", + " print('---------------------')" + ], + "code_language": "python", + "author": "Ilie Cristian Dorobat", + "author_links": { + "github": "iliedorobat", + "website": "https://iliedorobat.ro/" + }, + "category": [ + "pipeline", + "standalone" + ], + "tags": [ + "temporal", + "normalization", + "date", + "romanian", + "temporal-expression", + "dbpedia" + ] + }, { "id": "spacy-vscode", "title": "spaCy Visual Studio Code Extension",