381030 (1) [Avatar] Offline
#1
book example: from nlpia.data import get_data

research-hack: from nlpia.data.loaders import get_data

Is "loaders" for the beta version?
hobs (46) [Avatar] Offline
#2
Good catch. We need to be consistent. For now, using `nlpia.data.loaders.get_data` is the right way to import data loaders.
475801 (2) [Avatar] Offline
#3
Yet another small issue caused by renamed constants
>>> from nlpia.data.loaders import get_data
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/devteam/Code/nlpia/nlpia/data/loaders.py", line 14, in <module>
    from pugnlp.constants import MAX_INT64 as MAX_INT
ImportError: cannot import name 'MAX_INT64'
>>>



Fix is easy:
$ git diff
diff --git a/nlpia/data/loaders.py b/nlpia/data/loaders.py
index a275a98..1879b35 100644
--- a/nlpia/data/loaders.py
+++ b/nlpia/data/loaders.py
@@ -11,8 +11,8 @@ from nlpia.constants import logging, DATA_PATH, BIGDATA_PATH

 from tqdm import tqdm
 from pugnlp.futil import path_status, find_files
-from pugnlp.constants import MAX_INT64 as MAX_INT
-from pugnlp.constants import MIN_INT64 as MIN_INT
+from pugnlp.constants import INT64_MAX as MAX_INT
+from pugnlp.constants import INT64_MIN as MIN_INT
 import pandas as pd
 import tarfile

316854 (1) [Avatar] Offline
#4
ModuleNotFoundError: No module named 'nlpia.data'
In Page 57 after running from
>>>nlpia.data.loaders import get_data

I am getting the following error

ModuleNotFoundError Traceback (most recent call last)
<ipython-input-139-151f96be4fbb> in <module>()
----> 1 from nlpia.data.loaders import get_data

ModuleNotFoundError: No module named 'nlpia.data'
hobs (46) [Avatar] Offline
#5
You need to make sure you import the full path before you use the full path when calling the `get_data()` function. This worked for me on version 1.19 (April 16th):

>>> import nlpia.data.loaders
>>> nlpia.data.loaders.get_data()
      spam                                               text
0        0  Go until jurong point, crazy.. Available only ...
...
4836     0                         Rofl. Its true to its name

[4837 rows x 2 columns]
>>> nlpia.__version__
'0.1.27'
hobs (46) [Avatar] Offline
#6
Really appreciate you finding these bugs and helping us build a high quality book. We now have automated unit testing to try to prevent these kinds of bugs.
578126 (2) [Avatar] Offline
#7
Thank you for writing such an energetic book and providing a virtual environment in which to run the examples. I'm having trouble, though in Chapter 2's NB sentiment analyzer example.

After cloning the NLPIA repo and setting up my Python 3.6 conda env using the yml configuration on my Windows 7 machine, the nlpia package was not installed. I could not conda install it, even through the most up-to-date command on the anaconda site. After pip-installing nlpia 0.1.31, I tried the following command

import nlpia.data.loaders as nlpia_load


and obtained several error messages, ending with

AttributeError: module 'numpy' has no attribute 'float128'


NumPy 1.14.3 was installed per the yml, but could the version be incorrect? Any other suggestion?
hobs (46) [Avatar] Offline
#8
Very weird. Thank you for sharing. My fresh install of the conda environment on Mac and Linux for the latest version of `nlpia` doesn't seem to have this problem. And the automated tests on Travis all pass (finally smilie). Could you provide more details about your OS and environment (`pip freeze` please)? If you file this as an issue on github, we'll be able to help you more quickly (I just now saw this).