MaartenGr / MaartenGr/BERTopic

SpaCy installed but PartOfSpeech not working

Open
#1,741 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

I get the following error when running the code:

import spacy
import bertopic
from bertopic.representation import PartOfSpeech
aspect_model1 = PartOfSpeech("en_core_web_sm")

Error message:

Traceback (most recent call last):
File "C:\Users\w\AppData\Local\Programs\Python\Python311\Lib\site-packages\IPython\core\interactiveshell.py", line 3433, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
aspect_model1 = PartOfSpeech("en_core_web_sm")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wzy98\Documents\Temp files\New Files\Twitter_0111\scrapfly\venv\Lib\site-packages\bertopic\_utils.py", line 100, in __call__
raise ModuleNotFoundError(self.msg)
ModuleNotFoundError: In order to use Part of Speech with Spacy you will need to install via;
pip install bertopic[spacy]

I tried pip install bertopic[spacy] in terminal, but it does not work. Using python 3.11, spaCy 3.7.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported import with Python 3.11 and spaCy 3.7.2, then inspect bertopic/_utils.py around line 100 and the package extras configuration. Capture the actual output from installing bertopic[spacy]; the issue is done when the documented installation enables PartOfSpeech without raising ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.