spacy

ImportError: cannot import name 'deprecated' from 'typing_extensions'

ImportError: cannot import name 'deprecated' from 'typing_extensions' Question: I want to download spacy, but the version of typing-extensions is lowered in the terminal: ERROR: pydantic 2.3.0 has requirement typing-extensions>=4.6.1, but you’ll have typing-extensions 4.4.0 which is incompatible. ERROR: pydantic-core 2.6.3 has requirement typing-extensions!=4.7.0,>=4.6.0, but you’ll have typing-extensions 4.4.0 which is incompatible. Installing collected packages: typing-extensions …

Total answers: 1

Reading files in a directory and saving each dynamically

Reading files in a directory and saving each dynamically Question: text_open = open("inputfiles/(22).txt", "r") text = text_open.read() doc = nlp(text) db.add(doc) db.to_disk("./outputfiles/22.spacy") I am trying to loop over each of the 500+ documents in the inputfiles folder and output them through db.to_disk. Instead of changing the hard coded numbers every-time, how would I dynamically rename …

Total answers: 1

Python NLP processing if statement not in stop words list

Python NLP processing if statement not in stop words list Question: I’m working with NLP spacy library and I created a function to return a list of token from a text. import spacy def preprocess_text_spacy(text): stop_words = ["a", "the", "is", "are"] nlp = spacy.load(‘en_core_web_sm’) tokens = set() doc = nlp(text) for word in doc: if …

Total answers: 4

How to normalise keywords extracted with Named Entity Recognition

How to normalise keywords extracted with Named Entity Recognition Question: I’m trying to employ NER to extract keywords (tags) from job postings. This can be anything along with React, AWS, Team Building, Marketing. After training a custom model in SpaCy I’m presented with a problem – extracted tags are not unified/normalized across all of the …

Total answers: 2

Getting a weird behaviour when using Matcher from Spacy several times

Getting a weird behaviour when using Matcher from Spacy several times Question: I would like to use Matcher from Spacy on a list of span (sents) class Chunker: def __init__(self, nlp, matcher): self.nlp = nlp self.matcher = matcher self.matcher.add("NP", NP_pattern, on_match=self.on_match_callback, greedy="LONGEST") self.matcher.add("VP", VP_pattern, on_match=self.on_match_callback, greedy="LONGEST") self.matcher.add("VVP", VVP_pattern, on_match=self.on_match_callback, greedy="LONGEST") def on_match_callback(self, matcher, doc, i, …

Total answers: 1

Spacy incorrectly identifying pronouns

Spacy incorrectly identifying pronouns Question: When I try this code using Spacy, I get the desired result: import spacy nlp = spacy.load("en_core_web_sm") # example 1 test = "All my stuff is at to MyBOQ" doc = nlp(test) for word in doc: if word.pos_ == ‘PRON’: print(word.text) The output shows All and my. However, if I …

Total answers: 1