Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Confirm SpaCy installation and import PySBD project

hellyars
13 - Pulsar

 

This is a continuation of a few posts involving parsing sentences (from a body of text).

The issue is identifying the whole sentence when abbreviations with periods may be present.

I am exploring a combination of lookup tables or dynamic approaches using Python + a relevant library (e.g., NLTK and SpaCy)

Thanks to @danilang I was able to test NLTK using the Python tool, unfortunately stock NLTK had difficulty identifying sentences.

 

So, I am off trying a new suggested approach that once again is beyond my liberal arts skills.  This time I want to try SpaCy python Sentence Boundary Disambiguation (PySBD) project.  It appears to be better suited than NLTK to handle edge cases scenarios (e.g., U.S., Mass., Co., plc.) .

 

Two questions...

 

  1. I ran the following code in the Python tool to install SpaCy (Alteryx.installPackages("spacy")).   It returned a Call Process Error exactly the same as this post.   I ran the tool again today and it states "Requirement already satisfied." So, how can I confirm SpacY is actually installed correctly?
  2. How do you install the pySBD project from the Alteryx Python tool?  It does not appear to be included in the vanilla SpaCy installation.  I tried import pysbd, import pysbd.utils, from pysbd.utils import PySDBFactory, import pySBDFactory, etc.  They all generate a ModuleNotFoundError.

 

 

 

2 REPLIES 2
JessieC
Alteryx
Alteryx

@hellyars - what version of AYX Designer do you have? See Help > About - Depending on the version, you can check the file paths listed here - https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-To-Use-Alteryx-installPackages-...or follow "Procedure: List the Currently Installed Modules"

 

%ALTERYX%\bin\Miniconda3\PythonTool_venv\Lib\site-packages until 2019.2

%ALTERYX%\bin\Miniconda3\envs\JupyterTool_vEnv\Lib\site-packages for 2019.3.1 to 2021.1.3

%ALTERYX%\bin\Miniconda3\envs\DesignerBaseTools_vEnv\Lib\site-packages for 2021.1.4+

 

You can install python packages via command prompt (run as admin) - https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Install-Python-packages-via-command... 

 

For 2021.1.4+

Activate DesignerBaseTools_venv:

  1. cd "C:\Program Files\Alteryx\bin\Miniconda3\Scripts"
  2. activate DesignerBaseTools_vEnv
  3. cd "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_vEnv\Scripts" 
  4. pip install pysbd

JessieC_0-1667446662152.png

 

from ayx import Alteryx
import re
from pandas import DataFrame
import io
from contextlib import redirect_stdout

with io.StringIO() as current_output, redirect_stdout(current_output):

Alteryx.installPackages(package='',install_type='freeze')

packages = ( (item for item in out_row.split("=") if item)
for out_row in re.split(string=current_output.getvalue(),pattern=r"\r*\n") if out_row)

output_df = DataFrame(packages ,columns=["package","version"])

Alteryx.write(output_df,1)

 

JessieC_1-1667446718893.png

hellyars
13 - Pulsar

@JessieC   Thanks. I will have to try this out -- but it might take a bit, this isn't exactly my cup of tea.

Labels
Top Solution Authors