0

Sudden problems with textacy

text3 = textacy.normalize_whitespace(text2) 

AttributeError: module 'textacy' has no attribute 'normalize_whitespace'

This happens in Python 3.7

The script worked perfectly for the past year. The other day this error started happening. I feel I've tried everything. The line is critical to the program.

I created a python 3.6 env and an earlier version of textacy. Can't import textacy there because it says I don't have cachetools - I do.

Is there an approach you can recommend?

Ethe99
  • 49
  • 8

1 Answers1

2

This method is located at textacy.preprocessing, cf here and here, so you'll have to change the code to:

from textacy import preprocessing
text3 = preprocessing.normalize_whitespace(text2)
Sofie VL
  • 2,931
  • 2
  • 12
  • 22
  • You are correct - I've tried that also but it does not work. I went back to versions from last year even, prior textacy, conda and spacy and still...how could it have worked before and not now? This seems crazy. – Ethe99 Apr 05 '20 at 17:32
  • 1
    I just tried a clean install of `textacy` in a new environment. I edited my original answer, the code above should work now. – Sofie VL Apr 06 '20 at 17:16