text stringlengths 81 47k | source stringlengths 59 147 |
|---|---|
Question: <p>When I try to import <a href="https://spacy.io/" rel="nofollow noreferrer">spaCy</a> (for the first time), I get the follwoing error:</p>
<pre><code>>>>import spacy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import spacy
File "/Library/Framework... | https://stackoverflow.com/questions/46887236/import-spacy-error |
Question: <p>I am trying to train a text categorization pipe in SpaCy:</p>
<pre class="lang-py prettyprint-override"><code>import spacy
nlp = spacy.load("en_core_web_sm")
nlp.add_pipe("textcat", last=True)
other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'textcat']
with nlp.disable_pipes(*... | https://stackoverflow.com/questions/66367447/spacy-cant-find-tables-lexeme-norm-for-language-en-in-spacy-lookups-data |
Question: <p>I'm trying to install spacy by running <code>pip install spacy</code> for python version <strong>3.6.1</strong> but continuously i'm getting errors like below,how to get rid of this issue? previously i was having cl.exe not found error, after that i added visual studio path in environment variables where c... | https://stackoverflow.com/questions/43370851/failed-building-wheel-for-spacy |
Question: <p>I am trying to understand how similarity in Spacy works. I tried using Melania Trump's <a href="http://time.com/4412008/republican-convention-melania-trump-2/" rel="noreferrer">speech</a> and Michelle Obama's <a href="https://www.npr.org/templates/story/story.php?storyId=93963863" rel="noreferrer">speech</... | https://stackoverflow.com/questions/53453559/similarity-in-spacy |
Question: <p>Installation of spacy-lefff v. 0.3.3 makes it impossible to run a Python program with module Spacy (v. 2.1.1)</p>
<p>The root problem seems to be the modules thinc and cymem. I tried to unstalled thinc and cymem but i don't know which version of thinc and cymem to reinstall afterwords.</p>
<p>There is no... | https://stackoverflow.com/questions/55309497/latest-version-of-spacy-lefff-incompatible-with-latest-version-of-spacy |
Question: <p>I'm using Spacy-Transformers to build some NLP models.</p>
<p>The <a href="https://spacy.io/universe/project/spacy-transformers#gatsby-noscript" rel="nofollow noreferrer">Spacy-Transformers docs</a> say:</p>
<blockquote>
<p><strong>spacy-transformers</strong></p>
<p><em>spaCy pipelines for pretrained BERT,... | https://stackoverflow.com/questions/68946827/spacy-transformers-access-gpt-2 |
Question: <p>I am following the spaCy installation guideline inside my AWS SageMaker notebook</p>
<pre><code>pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_sm
</code></pre>
<p>When I do <code>import spacy</code> I get error</p>
<pre><code>ModuleNotFoundError: No module nam... | https://stackoverflow.com/questions/69716018/modulenotfounderror-no-module-named-spacy-even-though-spacy-and-python-are-in |
Question: <p>SpaCy doesn't support the Arabic language, but Can I use SpaCy with the pretrained Arabert model?</p>
<p>Is it possible to modify this code so it can accept bert-large-arabertv02 instead of en_core_web_lg?</p>
<pre><code>!python -m spacy download en_core_web_lg
import spacy
nlp = spacy.load("en_core_w... | https://stackoverflow.com/questions/74062240/using-arabert-model-with-spacy |
Question: <p>I've been using NLTK for finding collocations, or n-grams, and have recently discovered the spaCy module for NLP. I've only just begun familiarizing myself with it and have, thus far, seen little mention for supported collocation functions.</p>
<p>Can spaCy be used to find collocations directly?</p>
<p>I... | https://stackoverflow.com/questions/39258476/collocations-with-spacy |
Question: <p>I'm trying to install SpaCy on my docker image but it always fails. First it was on my requirements.txt file, but it failed right away. Later on I tried running a separate RUN instruction for pip to install it in isolation but it also failed.</p>
<p>Here's my Dockerfile content:</p>
<pre><code>FROM python:... | https://stackoverflow.com/questions/67394064/spacy-and-docker-cant-dockerize-flask-app-that-uses-spacy-modules |
Question: <p>Just like spacy displacy renders entity highlights in html.</p>
<pre><code>import spacy
from spacy import displacy
nlp = spacy.load('en')
doc1 = nlp(u'This is a google sentence.')
doc2 = nlp(u'This is another sentence.')
html = displacy.render([doc1, doc2], style='ent', page=True)
</code></pre>
<p>How to... | https://stackoverflow.com/questions/51739273/spacy-verb-highlight |
Question: <p>Being complete python novice, I am trying to learn some spaCy basics. Problem is, I can not load any models.</p>
<p>I am using Microsoft Visual Studio Community(MVSC), Windows 7, Python 3.7.5., pip 19.2.3 spaCy has been installed via pip on Python 3.7 (64-bit) environment.</p>
<p>(1) when I run in MVSC:</p... | https://stackoverflow.com/questions/63683431/failed-to-load-spacy-model-en-core-web-sm |
Question: <p>After downloading and linking a spacy model (en large) by:</p>
<pre><code>python -m spacy download en_core_web_lg
</code></pre>
<p>which is around 850 Mb of data.</p>
<p>How can it find and delete the data (downloaded model) on my mac to free some space?</p>
<pre><code>Spacy: 2.0.18
Python: 3.6.9
e... | https://stackoverflow.com/questions/50344228/remove-spacy-downloaded-model |
Question: <p>I managed to install spacy but when trying to use nlp then I am getting a MemoryError for some weird reason.</p>
<p>The code I wrote is as follows:</p>
<pre><code>import spacy
import re
from nltk.corpus import gutenberg
def clean_text(astring):
#replace newlines with space
newstring=re.sub("\n",... | https://stackoverflow.com/questions/54014422/spacy-memoryerror |
Question: <p>The latest spaCy versions have better performance and compatibility for GPU acceleration on Apple devices, but I have an existing project that depends on spaCy 3.1.4 and some of the specific behavior of the 3.1.0 models (web lg, web trf).</p>
<p>Would it be possible to port the old models from source to wo... | https://stackoverflow.com/questions/79583668/can-older-spacy-models-be-ported-to-future-spacy-versions |
Question: <p>I currently use spaCy to traverse the dependency tree, and generate entities. </p>
<pre><code>nlp = get_spacy_model(detect_lang(unicode_text))
doc = nlp(unicode_text)
entities = set()
for sentence in doc.sents:
# traverse tree picking up entities
for token in sentence.subtree:
## pick entitites ... | https://stackoverflow.com/questions/41196081/spacy-alternatives-in-java |
Question: <h2>1 - THE PROBLEM</h2>
<p>I'm using "spacy" on python for text documents lemmatization.
There are 500,000 documents having size up to 20 Mb of clean text.</p>
<p>The problem is the following: spacy memory consuming is growing in time till the whole memory is used.</p>
<h2>2 - BACKGROUND</h2>
<p>My hardw... | https://stackoverflow.com/questions/55841087/python-spacy-and-memory-consumption |
Question: <p>I wanted to convert conllu format for Hindi to json using spacy convert and it is generating jsonl format. When I pass on the same .jsonl file to spacy train I am getting an error. If I pass a json file to the train command, it is working. Shouldn't the output of spacy convert be compatible with spacy trai... | https://stackoverflow.com/questions/55615335/output-of-spacy-convert-command-not-compatible-with-spacy-train-command |
Question: <p>I tried to install spacy though conda with the command:</p>
<pre><code> conda install -c conda-forge spacy
</code></pre>
<p>The package was installed seemingly uneventfully. But when I tried to import spacy I got an exception.
It seems the module pydantic is not cooperating well. I am a bit surprised t... | https://stackoverflow.com/questions/76869787/can-not-install-spacy-successfully |
Question: <p>I am using spacy un some nlp project.</p>
<p>I have texts in which text like this appear:</p>
<pre><code> text='The car comprises 4 brakes 4.1, 4.2, 4.3 and 4.4 in fig. 5, all include an ESP system. This is shown in Fig. 6. Fig. 5 shows how the motors 56 and 57 are blocked. Besides the doors (44, 45) are p... | https://stackoverflow.com/questions/71481327/tweek-spacy-spans |
Question: <p>In a Jupyter Notebook, using Python 3.9.9</p>
<p>I went to <a href="https://spacy.io/usage" rel="nofollow noreferrer">https://spacy.io/usage</a> and followed the instructions for installing Spacy</p>
<p>• MacOS/OSX</p>
<p>• conda</p>
<p>• virtual env</p>
<p>• English</p>
<p>• efficiency</p>
<pre class="lan... | https://stackoverflow.com/questions/70102594/installing-spacy-returns-set-default-tensor-type-error |
Question: <p>I want to combine spaCy's NER engine with a separate NER engine (a BoW model). I'm currently comparing outputs from the two engines, trying to figure out what the optimal combination of the two would be. Both perform decently, but quite often spaCy finds entities that the BoW engine misses, and vice versa.... | https://stackoverflow.com/questions/46934523/how-to-get-spacy-ner-probability |
Question: <p>I have been trying to understand how to systematically make Spacy run as fast as possible for a long time and I would like this post to become a wiki-style public post if possible.</p>
<p>Here is what I currently know, with subsidiary questions on each point:</p>
<p><strong>1. Space will run faster on fast... | https://stackoverflow.com/questions/74181750/a-checklist-for-spacy-optimization |
Question: <p>I have limited disk memory and want to know how to uninstall/remove files for spacy 2.xx under python 2.7 (I use python3 and think I've got spacy installed correctly for it). Ditto for the default model in my python3 install. Here's my terminal session:</p>
<pre><code>gw-mac-pro:~ gr$ pip install -U spacy... | https://stackoverflow.com/questions/53052868/dont-know-how-to-uninstall-unwanted-spacy-installation-model |
Question: <p>There are tickets or bugs across the internet on this and because there's Spacy 2.3 and 3.0 I can't tell which is relevant. I'm running 2.3 because moving to 3.0 is like moving to dojo 2.0. All that youtube watching is down the drain. Anyway, the following works:</p>
<pre><code>spacy.load(r'C:\Users\mar... | https://stackoverflow.com/questions/66048470/spacy-cannot-find-model |
Question: <p>I am facing the below error while installing Spacy.</p>
<pre><code>requests.exceptions.SSLError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /explosion/spacy-models/master/compatibility.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICA... | https://stackoverflow.com/questions/68205676/ssl-certificate-error-while-installing-spacy |
Question: <p>As the title says, I am unable to use the spacy cli tools. I get <code>No module named spacy</code> error when I try to run <code>python3 -m spacy download en_core_web_trf</code>.</p>
<p>I was able to install the sm, md and lg models a few days ago. But now it doesnt seem to be working. I have spacy v3 in... | https://stackoverflow.com/questions/69082919/spacy-cli-tools-not-functioning |
Question: <p>I'm in a MacBook Pro with M1 Pro chip, and I've built a Docker to install Tensorflow, spacy, etc.
My Dockerfile:</p>
<pre><code>FROM --platform=linux/x86_64 python:3.8
ENV PYTHONUNBUFFERED 1
RUN apt-get update && apt-get -y upgrade
RUN pip install --upgrade pip
RUN pip install TensorFlow==2.3.4
R... | https://stackoverflow.com/questions/70658085/spacy-download-on-apple-m1-chip |
Question: <p>I'm going to check for grammar in the sentences I give as input. If <strong>spaCy</strong> identifies <code>PRP</code> and <code>MD</code> and <code>NN</code> in a sentence then it will give me a text output</p>
<blockquote>
<p>there is a prp, md and nn in the sentence</p>
</blockquote>
<p>The problem ... | https://stackoverflow.com/questions/48356424/processing-grammar-using-spacy |
Question: <p>Say I have a dataset, like</p>
<pre><code>iris = pd.DataFrame(sns.load_dataset('iris'))
</code></pre>
<p>I can use <code>Spacy</code> and <code>.apply</code> to parse a string column into tokens (my real dataset has >1 word/token per entry of course)</p>
<pre><code>import spacy # (I have version 1.8.2)
... | https://stackoverflow.com/questions/44395656/applying-spacy-parser-to-pandas-dataframe-w-multiprocessing |
Question: <p>When I am running my NER model I am getting:</p>
<pre><code>UserWarning: [W031] Model 'en_model' (0.0.0) requires spaCy v2.2 and is incompatible with the current spaCy version (2.3.2)
</code></pre>
<p>Please advise how can I fix it?</p>
<p>Python 3.7.9, spaCy 2.3.2, Ubuntu 18.04.</p>
Answer: <p>Solved by ... | https://stackoverflow.com/questions/64035821/how-to-fix-spacy-en-model-incompatible-with-current-spacy-version-2-3-2 |
Question: <p>I am using trying to install spacy library using 'pip install -U spacy' in the command prompt (run as admin) in Windows-11 O.S., but it shows some error I don't understand. I am using Python 3.13.0, gcc 13.2.0 and make 4.4.1. What could be the problem? Or is there any other way to install spacy?</p>
<pre c... | https://stackoverflow.com/questions/79260748/how-to-install-spacy |
Question: <h2 id="background-hnaq">Background</h2>
<p>I'm woking on the following local environment and need to use spaCy 3.0 on GoogleColab.</p>
<p>However, it looks accepted to install spaCy after 3.0 because of python version.</p>
<pre><code>spaCy version 3.0.5
Python version 3.9.1
</... | https://stackoverflow.com/questions/68494390/trouble-to-install-spacy-3-0-on-googlecolab |
Question: <p>So I was compiling spacy from source. I have cython v23.4 installed. when I run <code>pip install -e .</code> in the <code>spaCy</code> directory, I get this:
`Obtaining file:///home/nitish/spaCy
Complete output from command python setup.py egg_info:</p>
<pre><code>Error compiling Cython file:
-------... | https://stackoverflow.com/questions/41972099/spacy-installation-error-running-cythonize-failed |
Question: <p>I try to install SpaCy for lemmatization, but it won't work...</p>
<p>First I install spacy:</p>
<pre><code>pip install -U spacy
</code></pre>
<p>Which leads to this results:</p>
<pre><code>Requirement already satisfied, skipping upgrade: murmurhash<1.1.0,>=0.28.0 in c:\users\danis\.conda\envs\python... | https://stackoverflow.com/questions/64268889/install-spacy-in-a-jupyter-notebook |
Question: <p>I would like to lemmatize some textual data in Hungarian language and encountered a strange feature in <code>spaCy</code>. The <code>token.lemma_</code> function works well in terms of lemmatization, however, it returns some of the sentences without first letter capitalization. This is quite annoying, as m... | https://stackoverflow.com/questions/63693463/spacy-lemmatizer-removes-capitalization |
Question: <p>I am trying to download en_vectors_web_lg, but keep getting the below error:</p>
<pre><code>ERROR: Could not install requirement en-vectors-web-lg==3.0.0 from https://github.com/explosion/spacy-models/releases/download/en_vectors_web_lg-3.0.0/en_vectors_web_lg-3.0.0-py3-none-any.whl#egg=en_vectors_web_lg==... | https://stackoverflow.com/questions/67361527/what-versions-of-spacy-suport-en-vectors-web-lg |
Question: <p>I am trying to evaluate a trained NER Model created using <a href="https://spacy.io/docs/usage/training-ner" rel="noreferrer">spacy lib</a>.
Normally for these kind of problems you can use f1 score (a ratio between precision and recall). I could not find in the documentation an accuracy function for a tra... | https://stackoverflow.com/questions/44827930/evaluation-in-a-spacy-ner-model |
Question: <p>When I try this code using Spacy, I get the desired result:</p>
<pre><code>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)
</code></pre>
<p>The outpu... | https://stackoverflow.com/questions/75141938/spacy-incorrectly-identifying-pronouns |
Question: <p>I am trying to use spaCy's SpanGroup class, but the following commands both give a ModuleNotFoundError:</p>
<p><code>from spacy.tokens.span_group import SpanGroup</code> and
<code>from spacy.tokens import SpanGroup</code></p>
<p>I tried looking at the spaCy documentation, but their command wasn't working. ... | https://stackoverflow.com/questions/68537075/spacy-spangroup |
Question: <p>I am getting Permission error 13 when trying to save a trained model in spacy. I have tried changing the directory as well. I am trying to reproduce this example given <a href="https://spacy.io/usage/training#example-new-entity-typetrain_new_entity_type.py" rel="nofollow noreferrer">here</a>, to train cust... | https://stackoverflow.com/questions/48165486/spacy-permission-error-13 |
Question: <p>How to test accuracy of a spacy pretrained model in version 3.0.1. I want to see my output how accurate my tested model is predicted.This the code below for spacy version 2 but it doesn't work in spacy version 3.can somone tell me the code on spacy version 3.</p>
<pre><code> from spacy.gold import GoldPars... | https://stackoverflow.com/questions/66637485/spacy-3-0-1-accuracy-prediction |
Question: <p>I am new to Spacy and NLP. I'm facing the below issue while doing sentence segmentation using Spacy.</p>
<p>The text I am trying to tokenise into sentences contains numbered lists (with space between numbering and actual text), like below.</p>
<pre class="lang-py prettyprint-override"><code>import spacy
nl... | https://stackoverflow.com/questions/52205475/custom-sentence-segmentation-using-spacy |
Question: <p>I need to train a spaCy model to improve the accuracy to identify products. I'm struggling with training my spacy model. I have the following code:</p>
<pre><code>TRAIN_DATA = [('..., {'entities': [(36,55,'PRODUCT')]})]
nlp = spacy.load("en_core_web_lg")
ner = nlp.get_pipe("ner")
optim... | https://stackoverflow.com/questions/68048737/training-spacy-nameerror |
Question: <p>I've tried several methods of loading the google news word2vec vectors (<a href="https://code.google.com/archive/p/word2vec/" rel="noreferrer">https://code.google.com/archive/p/word2vec/</a>):</p>
<pre><code>en_nlp = spacy.load('en',vector=False)
en_nlp.vocab.load_vectors_from_bin_loc('GoogleNews-vectors-... | https://stackoverflow.com/questions/42094180/spacy-how-to-load-google-news-word2vec-vectors |
Question: <p><strong>What I want to achieve:</strong></p>
<p>Import spacy and use it.</p>
<p><em><strong>What I've tried:</strong></em></p>
<p>When I try to import spacy on python I get <strong>ImportError: cannot import name util</strong> error (detail on error1)</p>
<p>Spacy is sucessfully installed to my device.</p>... | https://stackoverflow.com/questions/76319917/python-unable-to-import-spacy-and-download-en-core-web-sm |
Question: <p>Hi guys I'm having a problem with installing SpaCy on Windows/Anaconda.
I was trying:</p>
<p><strong>conda install -c conda-forge spacy</strong></p>
<p>And I'm getting an error:</p>
<pre class="lang-none prettyprint-override"><code>Collecting package metadata (repodata.json): done
Solving environment: f... | https://stackoverflow.com/questions/61259713/instaling-spacy-for-anaconda |
Question: <p>I want to use spacy for processing an already pre-tokenized text. Parsing a list of tokens to spacy does not work.</p>
<pre class="lang-py prettyprint-override"><code>import spacy
nlp = spacy.load("en_core_web_sm")
nlp(["This", "is", "a", "sentence"])
</code></pre>
<p>This gives a TypeError (which makes ... | https://stackoverflow.com/questions/59115914/use-spacy-on-pretokenized-text |
Question: <p>How to use lemmatization in Spacy? I try with this code but the output is blank. My spacy ver. 3.2.0</p>
<pre><code>from spacy.lang.id import Indonesian
nlp = Indonesian()
def tokenizer(text):
return [token.lemma_.lower() for token in nlp(text) if not token.is_stop and not token.is_punct]
docs = [
... | https://stackoverflow.com/questions/70147866/blank-lemmatization-using-spacy |
Question: <p>The following code fragment (modified from spaCy sample code) generates a KeyError that I just can't figure out:</p>
<pre><code>import en_core_web_sm
from spacy.gold import GoldParse
nlp = en_core_web_sm.load()
nlp.entity.add_label('ACCT')
TRAIN_DATA = [
("Exxon opened a new processing facility", {... | https://stackoverflow.com/questions/47807189/keyerror-in-spacy-goldparse |
Question: <p>Running python 3.11.3 on macos, Intel.</p>
<p>I had spacy working fine. I then decided to try adding gpu support with: <code>pip install -U 'spacy[cuda113]'</code> but started getting errors.</p>
<p>I uninstalled with <code>pip uninstall 'spacy[cuda113]'</code> and then reinstalled spacy with just <code>pi... | https://stackoverflow.com/questions/75978880/spacy-python-package-no-longer-runs |
Question: <p>i try to arabic vector with spacy, so i try code from this github
<a href="https://github.com/bakrianoo/aravec/blob/master/aravec-with-spacy.ipynb" rel="nofollow noreferrer">https://github.com/bakrianoo/aravec/blob/master/aravec-with-spacy.ipynb</a></p>
<p>when i use this code</p>
<pre><code>!python -m spa... | https://stackoverflow.com/questions/75565318/spacy-arabic-word2vector |
Question: <p>Runing the command in the instruction:</p>
<pre><code>pip install -U spacy
</code></pre>
<p>It fails to build wheel for Building wheels for collected packages: spacy, murmurhash, cymem, preshed, thinc, ujson, regex, cytoolz</p>
<p>This is the error shown on the terminal.</p>
<pre><code> Running setup.... | https://stackoverflow.com/questions/50837733/issue-with-install-spacy |
Question: <p>I am trying to load "en_core_web_sm" in spacy but getting the following error</p>
<p><em>Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))</em></p>
<pre><code>import spacy
from spacy import displacy
from spacy impo... | https://stackoverflow.com/questions/76006334/error-while-executing-python-m-spacy-download-en-core-web-sm-in-spacy-python |
Question: <p>I wrote a lemma tokenizer using spaCy for scikit-learn based on their <a href="http://scikit-learn.org/stable/modules/feature_extraction.html" rel="noreferrer">example</a>, it works OK standalone:</p>
<pre><code>import spacy
from sklearn.feature_extraction.text import TfidfVectorizer
class LemmaTokenizer... | https://stackoverflow.com/questions/45196312/spacy-and-scikit-learn-vectorizer |
Question: <p>I am trying to install spaCy on a Mac (OSX El Capitain). I am running python 2.7, have pip 18.0 and setuptools 40.0.</p>
<p>Whenever I run 'sudo pip install spacy', I get the following:</p>
<pre><code>Installing collected packages: numpy, murmurhash, cymem, preshed, msgpack, msgpack-numpy, toolz, cytoolz... | https://stackoverflow.com/questions/51501274/python-cannot-install-spacy |
Question: <p>I'm using spacy tokenizer to tokenize my data, and then build vocab.</p>
<p>This is my code:</p>
<pre><code>import spacy
nlp = spacy.load("en_core_web_sm")
def build_vocab(docs, max_vocab=10000, min_freq=3):
stoi = {'<PAD>':0, '<UNK>':1}
itos = {0:'<PAD>', 1:'<UNK>'}
w... | https://stackoverflow.com/questions/66838185/build-vocab-using-spacy |
Question: <p>spaCy splits a sentence incorrectly when there are dots for abbreviations.</p>
<pre><code>import spacy
tool = spacy.load('en')
x = tool('It starts at 9:00 a.m. Eastern Standard Time.')
list(x.sents)
</code></pre>
<p>produces two sentences instead of one. How do I do this correctly?</p>
Answer: <p>If you... | https://stackoverflow.com/questions/53968330/spacy-split-sentences-with-abbreviations |
Question: <p>I tried to get the morphological attributes of the verb using Spacy like below:</p>
<pre><code>import spacy
from spacy.lang.it.examples import sentences
nlp = spacy.load('it_core_news_sm')
doc = nlp('Ti è piaciuto il film?')
token = doc[2]
nlp.vocab.morphology.tag_map[token.tag_]
</code></pre>
<p>output ... | https://stackoverflow.com/questions/53755559/how-to-extract-tag-attributes-using-spacy |
Question: <p>Using the documentation here (<a href="https://spacy.io/api/coref" rel="nofollow noreferrer">https://spacy.io/api/coref</a>) to try and work a coreference resolution problem. I run into problems immediately when trying to add the pipe:</p>
<pre><code>nlp = spacy.load("en_core_web_md")
coref = nlp... | https://stackoverflow.com/questions/78732626/problem-initializing-experimental-spacy-coref |
Question: <p>I sorta have two issues, and I only mention both because I think they might be related.</p>
<p><strong>Problem 1:</strong></p>
<p>I believe I have two versions of Python3 downloaded (one through Anaconda) because when I run</p>
<pre><code>$ pip3 --version
</code></pre>
<p>I get</p>
<pre><code>pip 9.0.... | https://stackoverflow.com/questions/53200628/spacy-permission-denied |
Question: <p>I started using spacy (3.6.0) recently. I understand that I have to download pre-trained models every time I re-start my kernel. It worked well for a couple of times with</p>
<p><code>!python -m spacy download en_core_web_lg</code></p>
<p>Then it started giving me errors. A little bit of research helped me... | https://stackoverflow.com/questions/76789756/connecttimeout-error-while-downloading-spacy-models |
Question: <p>Trying to use spacy sentence tokenization for Hebrew.</p>
<pre><code>import spacy
nlp = spacy.load('he')
doc = nlp(text)
sents = list(doc.sents)
</code></pre>
<p>I get:</p>
<pre><code> Warning: no model found for 'he'
Only loading the 'he' tokenizer.
Traceback (most recent call last):
...
... | https://stackoverflow.com/questions/48572541/spacy-sentence-tokenization-error-on-hebrew |
Question: <p>I have some issues with spaCy missing Person entities. Below is an example when it seems like SpaCy is going blind when the name is preceded with certain titles. When you remove <code>Labour MP</code> (commented line) it recognises the name otherwise returns an empty list.</p>
<pre><code>import spacy
from... | https://stackoverflow.com/questions/49532259/spacy-person-entities-missing |
Question: <p>I'm aware of the basic spacy workflow for getting various attributes from a document, however I can't find a built in function to return the position (start/end) of a word which is part of a sentence.</p>
<p>Would anyone know if this is possible with Spacy?</p>
Answer: <p>These are available as attribute... | https://stackoverflow.com/questions/46049612/get-position-of-word-in-sentence-with-spacy |
Question: <p>So lately I've been playing around with a WikiDump.
I preprocessed it and trained it on Word2Vec + Gensim</p>
<p>Does anyone know if there is only one script within Spacy that would generate
tokenization, sentence recognition, part of speech tagging, lemmatization, dependency parsing, and named entity rec... | https://stackoverflow.com/questions/38986235/spacy-pipeline |
Question: <p>How do I change the size of figure drawn with Matplotlib?</p>
Answer: <p><a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.figure.html" rel="noreferrer"><code>figure</code></a> tells you the call signature:</p>
<pre><code>from matplotlib.pyplot import figure
figure(figsize=(8, 6), dpi=... | https://stackoverflow.com/questions/332289/how-do-i-change-the-size-of-figures-drawn-with-matplotlib |
Question: <p>This displays the figure in a GUI:</p>
<pre><code>import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [1, 4, 9])
plt.show()
</code></pre>
<p>But how do I instead save the figure to a file (e.g. foo.png)?</p>
Answer: <p>When using <a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.savefig... | https://stackoverflow.com/questions/9622163/save-plot-to-image-file-instead-of-displaying-it |
Question: <p>I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, as the size of the figure gets reduced.</p>
<ol>
<li>I want to keep the legend box outside the plot area (I want the legend to be outside... | https://stackoverflow.com/questions/4700614/how-to-put-the-legend-outside-the-plot |
Question: <p>How does one change the font size for all elements (ticks, labels, title) on a matplotlib plot?</p>
<p>I know how to change the tick label sizes, this is done with:</p>
<pre><code>import matplotlib
matplotlib.rc('xtick', labelsize=20)
matplotlib.rc('ytick', labelsize=20)
</code></pre>
<p>But how does... | https://stackoverflow.com/questions/3899980/how-to-change-the-font-size-on-a-matplotlib-plot |
Question: <p>What exactly is the use of <code>%matplotlib inline</code>?</p>
Answer: <p><code>%matplotlib</code> is a <a href="http://ipython.readthedocs.io/en/stable/interactive/tutorial.html#magics-explained" rel="noreferrer"><em>magic function</em></a> in IPython. I'll quote the relevant documentation here for you ... | https://stackoverflow.com/questions/43027980/purpose-of-matplotlib-inline |
Question: <p>I am trying to use IPython notebook on MacOS X with Python 2.7.2 and IPython 1.1.0.</p>
<p>I cannot get matplotlib graphics to show up inline.</p>
<pre><code>import matplotlib
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
</code></pre>
<p>I have also tried <code>%pylab inline</... | https://stackoverflow.com/questions/19410042/how-to-make-ipython-notebook-matplotlib-plot-inline |
Question: <p>Matplotlib offers these functions:</p>
<pre class="lang-py prettyprint-override"><code>cla() # Clear axis
clf() # Clear figure
close() # Close a figure window
</code></pre>
<p>When should I use each function and what exactly does it do?</p>
Answer: <p>They all do different things, since matplotlib use... | https://stackoverflow.com/questions/8213522/when-to-use-cla-clf-or-close-for-clearing-a-plot |
Question: <p>I am creating a figure in Matplotlib like this:</p>
<pre class="lang-py prettyprint-override"><code>from matplotlib import pyplot as plt
fig = plt.figure()
plt.plot(data)
fig.suptitle('test title')
plt.xlabel('xlabel')
plt.ylabel('ylabel')
fig.savefig('test.jpg')
</code></pre>
<p>I want to specify font si... | https://stackoverflow.com/questions/12444716/how-do-i-set-the-figure-title-and-axes-labels-font-size |
Question: <p>I am trying to fix how python plots my data. Say:</p>
<pre class="lang-py prettyprint-override"><code>x = [0, 5, 9, 10, 15]
y = [0, 1, 2, 3, 4]
matplotlib.pyplot.plot(x, y)
matplotlib.pyplot.show()
</code></pre>
<p>The x axis' ticks are plotted in intervals of 5. Is there a way to make it show intervals o... | https://stackoverflow.com/questions/12608788/changing-the-tick-frequency-on-the-x-or-y-axis |
Question: <p>How do I increase the figure size for <a href="https://matplotlib.org/2.0.2/examples/pylab_examples/subplots_demo.html" rel="noreferrer">this figure</a>?</p>
<p>This does nothing:</p>
<pre class="lang-py prettyprint-override"><code>f.figsize(15, 15)
</code></pre>
<p>Example code from the link:</p>
<pre cla... | https://stackoverflow.com/questions/14770735/how-do-i-change-the-figure-size-with-subplots |
Question: <p>In the pyplot document for scatter plot:</p>
<pre class="lang-py prettyprint-override"><code>matplotlib.pyplot.scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None,
vmin=None, vmax=None, alpha=None, linewidths=None,
faceted=True, verts=None... | https://stackoverflow.com/questions/14827650/pyplot-scatter-plot-marker-size |
Question: <p>I would like to apply colormap to an image, and write the resulting image, without using axes, labels, titles, or anything automatically added by matplotlib. Here is what I did:</p>
<pre><code>def make_image(inputname,outputname):
data = mpimg.imread(inputname)[:,:,0]
fig = plt.imshow(data)
fig... | https://stackoverflow.com/questions/9295026/how-to-remove-axis-legends-and-white-padding |
Question: <p>I need help with setting the limits of y-axis on matplotlib. Here is the code that I tried, unsuccessfully.</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
plt.figure(1, figsize = (8.5,11))
plt.suptitle('plot title')
ax = []
aPlot = plt.subplot(321, axisbg = 'w', title ... | https://stackoverflow.com/questions/3777861/how-to-set-the-axis-limits-in-matplotlib |
Question: <h2>Updated MRE with subplots</h2>
<ul>
<li>I'm not sure of the usefulness of the original question and MRE. The margin padding seems to be properly adjusted for large x and y labels.</li>
<li>The issue is reproducible with subplots.</li>
<li>Using <code>matplotlib 3.4.2</code></li>
</ul>
<pre class="lang-py ... | https://stackoverflow.com/questions/6774086/how-to-adjust-padding-with-cutoff-or-overlapping-labels |
Question: <p>I can't figure out how to rotate the text on the X Axis. Its a time stamp, so as the number of samples increase, they get closer and closer until they overlap. I'd like to rotate the text 90 degrees so as the samples get closer together, they aren't overlapping.</p>
<p>Below is what I have, it works fin... | https://stackoverflow.com/questions/10998621/rotate-axis-tick-labels |
Question: <p>I'm trying to plot a figure without tickmarks or numbers on either of the axes (I use axes in the traditional sense, not the matplotlib nomenclature!). An issue I have come across is where matplotlib adjusts the x(y)ticklabels by subtracting a value N, then adds N at the end of the axis.</p>
<p>This may b... | https://stackoverflow.com/questions/2176424/hiding-axis-text-in-matplotlib-plots |
Question: <p>I'm learning to use <code>matplotlib</code> by studying examples, and a lot of examples seem to include a line like the following before creating a single plot...</p>
<pre><code>fig, ax = plt.subplots()
</code></pre>
<p>Here are some examples...</p>
<ul>
<li><a href="https://stackoverflow.com/questions/... | https://stackoverflow.com/questions/34162443/why-do-many-examples-use-fig-ax-plt-subplots |
Question: <p>I want to plot a graph with one logarithmic axis using matplotlib.</p>
<p>Sample program:</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
a = [pow(10, i) for i in range(10)] # exponential
fig = plt.figure()
ax = fig.add_subplot(2, 1, 1)
line, = ax.plot(a, color='blue',... | https://stackoverflow.com/questions/773814/plot-logarithmic-axes |
Question: <p>Simple question here: I'm trying to get the size of my legend using <code>matplotlib.pyplot</code> to be smaller (i.e., the text to be smaller). The code I'm using goes something like this:</p>
<pre><code>plot.figure()
plot.scatter(k, sum_cf, color='black', label='Sum of Cause Fractions')
plot.scatter(k,... | https://stackoverflow.com/questions/7125009/how-to-change-legend-fontsize-with-matplotlib-pyplot |
Question: <p>Sometimes I come across code such as this:</p>
<pre><code>import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
fig = plt.figure()
fig.add_subplot(111)
plt.scatter(x, y)
plt.show()
</code></pre>
<p>Which produces:</p>
<p><img src="https://i.sstatic.net/yCOG3.png" alt="Example plot pr... | https://stackoverflow.com/questions/3584805/what-does-the-argument-mean-in-fig-add-subplot111 |
Question: <p>I am trying to plot a simple graph using pyplot, e.g.:</p>
<pre><code>import matplotlib.pyplot as plt
plt.plot([1,2,3],[5,7,4])
plt.show()
</code></pre>
<p>but the figure does not appear and I get the following message:</p>
<pre><code>UserWarning: Matplotlib is currently using agg, which is a non-GUI backe... | https://stackoverflow.com/questions/56656777/userwarning-matplotlib-is-currently-using-agg-which-is-a-non-gui-backend-so |
Question: <p>I would like to know how to simply reverse the color order of a given colormap in order to use it with plot_surface.</p>
Answer: <p>The standard colormaps also all have reversed versions. They have the same names with <code>_r</code> tacked on to the end. (<a href="https://matplotlib.org/stable/gallery/co... | https://stackoverflow.com/questions/3279560/reverse-colormap-in-matplotlib |
Question: <p>I need to generate a whole bunch of vertically-stacked plots in matplotlib. The result will be saved using <code>savefig</code> and viewed on a webpage, so I don't care how tall the final image is, as long as the subplots are spaced so they don't overlap.</p>
<p>No matter how big I allow the figure to be, ... | https://stackoverflow.com/questions/6541123/improve-subplot-size-spacing-with-many-subplots |
Question: <p>How do I change the size of my image so it's suitable for printing?</p>
<p>For example, I'd like to use an A4 paper, whose dimensions are 11.7 inches by 8.27 inches in landscape orientation.</p>
Answer: <p>You need to create the matplotlib Figure and Axes objects ahead of time, specifying how big the figu... | https://stackoverflow.com/questions/31594549/how-to-change-the-figure-size-of-a-seaborn-axes-or-figure-level-plot |
Question: <p>How can one create a legend for a line graph in Matplotlib's PyPlot without creating any extra variables?</p>
<p>Please consider the graphing script below:</p>
<pre class="lang-py prettyprint-override"><code>if __name__ == '__main__':
PyPlot.plot(length, bubble, 'b-',
length, ins, 'r-',... | https://stackoverflow.com/questions/19125722/adding-a-matplotlib-legend |
Question: <p>I am making a scatter plot in matplotlib and need to change the background of the actual plot to black. I know how to change the face color of the plot using:</p>
<pre><code>fig = plt.figure()
fig.patch.set_facecolor('xkcd:mint green')
</code></pre>
<p><a href="https://i.sstatic.net/UN6YB.png" rel="nore... | https://stackoverflow.com/questions/14088687/how-to-change-plot-background-color |
Question: <p>I have a semilogx plot and I would like to remove the xticks. I tried:</p>
<pre><code>plt.gca().set_xticks([])
plt.xticks([])
ax.set_xticks([])
</code></pre>
<p>The grid disappears (ok), but small ticks (at the place of the main ticks) remain. How to remove them?</p>
Answer: <p>The <a href="https://matp... | https://stackoverflow.com/questions/12998430/how-to-remove-xticks-from-a-plot |
Question: <p>I have issue after installing the <strong>matplotlib</strong> package unable to <strong>import matplotlib.pyplot as plt</strong>. Any suggestion will be greatly appreciate. </p>
<pre><code>>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in &... | https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python |
Question: <p>Given a plot of a signal in time representation, how can I draw lines marking the corresponding time index?</p>
<p>Specifically, given a signal plot with a time index ranging from 0 to 2.6 (seconds), I want to draw vertical red lines indicating the corresponding time index for the list <code>[0.22058956, 0... | https://stackoverflow.com/questions/24988448/how-to-draw-vertical-lines-on-a-given-plot |
Question: <p>I have one figure which contains many subplots.</p>
<pre><code>fig = plt.figure(num=None, figsize=(26, 12), dpi=80, facecolor='w', edgecolor='k')
fig.canvas.set_window_title('Window Title')
# Returns the Axes instance
ax = fig.add_subplot(311)
ax2 = fig.add_subplot(312)
ax3 = fig.add_subplot(313)
</co... | https://stackoverflow.com/questions/25239933/how-to-add-a-title-to-each-subplot |
Question: <p>In a matplotlib figure, how can I make the font size for the tick labels using <code>ax1.set_xticklabels()</code> smaller?</p>
<p>Further, how can one rotate it from horizontal to vertical?</p>
Answer: <p>Please note that newer versions of MPL have a shortcut for this task. An example is shown in the oth... | https://stackoverflow.com/questions/6390393/how-to-change-tick-label-font-size |
Question: <p>To add a legend to a matplotlib plot, one simply runs <code>legend()</code>.</p>
<p>How to <strong>remove</strong> a legend from a plot?</p>
<p>(The closest I came to this is to run <code>legend([])</code> in order to empty the legend from data. But that leaves an ugly white rectangle in the upper right ... | https://stackoverflow.com/questions/5735208/remove-the-legend-on-a-matplotlib-figure |
Question: <p>I have a scatter plot graph with a bunch of random x, y coordinates. Currently the Y-Axis starts at 0 and goes up to the max value. I would like the Y-Axis to start at the max value and go up to 0.</p>
<pre><code>points = [(10,5), (5,11), (24,13), (7,8)]
x_arr = []
y_arr = []
for x,y in points:
x_... | https://stackoverflow.com/questions/2051744/how-to-invert-the-x-or-y-axis |
Question: <p>I'm trying to use <code>matplotlib</code> to read in an RGB image and convert it to grayscale.</p>
<p>In matlab I use this:</p>
<pre><code>img = rgb2gray(imread('image.png'));
</code></pre>
<p>In the <a href="http://matplotlib.sourceforge.net/users/image_tutorial.html" rel="noreferrer">matplotlib tutori... | https://stackoverflow.com/questions/12201577/how-can-i-convert-an-rgb-image-into-grayscale-in-python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.