SAP-archive / contextual-ai

Contextual AI adds explainability to different stages of machine learning pipelines - data, training, and inference - thereby addressing the trust gap between such ML systems and their users. It does not refer to a specific algorithm or ML method — instead, it takes a human-centric view and approach to AI.
https://contextual-ai.readthedocs.io/en/latest
Apache License 2.0
86 stars 12 forks source link

Failing step 3. Text in data_explorer.ipynb #14

Closed Sygyzmundovych closed 3 years ago

Sygyzmundovych commented 4 years ago

When in data_explorer.ipynb executing

labelled_analyzer = LabelledTextDataAnalyzer(preprocess_fn=preprocess,stop_words_by_languages=['english'],
                                             predefined_pattern=predefined_pattern)
labelled_analyzer.feed_all(texts,labels)
labelled_stats, all_stats = labelled_analyzer.get_statistics()
plotter.plot_labelled_text_stats(labelled_stats, all_stats)

the error is thrown:

...
LookupError: 
**********************************************************************
  Resource stopwords not found.
  Please use the NLTK Downloader to obtain the resource:

  >>> import nltk
  >>> nltk.download('stopwords')

  For more information see: https://www.nltk.org/data.html

  Attempted to load corpora/stopwords

  Searched in:
    - '/home/jovyan/nltk_data'
    - '/opt/conda/nltk_data'
    - '/opt/conda/share/nltk_data'
    - '/opt/conda/lib/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
    - '/opt/conda/lib/python3.7/site-packages/xai/data'
**********************************************************************

Seems like a cell is missing with:

import nltk
nltk.download('stopwords')
postalC commented 4 years ago

Hi @Sygyzmundovych thanks for the feedback. It is intended for not 'download' any source/lib automatically without the consent of executer.

But you are right, we shall add a note on it to make the tutorial complete. thanks @wangjin1024 FYI

postalC commented 3 years ago

https://github.com/SAP/contextual-ai/pull/16 @Sygyzmundovych FYI