Textagon is a powerful tool for text data analysis, providing a means to visualize parallel representations of your data and gain insight into the impact of various lexicons on two classes of text data.
Project description
Textagon
Textagon is a powerful tool for text data analysis, providing a means to visualize parallel representations of your data and gain insight into the impact of various lexicons on two classes of text data.
- Parallel Representations
- Graph-based Feature Weighting
Run DEMO
https://colab.research.google.com/drive/115P0Psl49CQIp9InJXJxQKMoN9NmfDvt
Test in local
conda activate your_env
pip install .
Installation
Initial Setup
pip install textagon # Install the package using pip
textagon_post_install # Run the post-installation script
Upgrading Textagon
pip install --upgrade textagon # Upgrade the package using pip
textagon_post_install # Run the post-installation script
Updating the Package for Development (Only for developer)
# On Windows
rmdir /s /q ./build ./dist ./textagon.egg-info
# On Linux
rm -rf ./build ./dist ./textagon.egg-info
# Then, run
python setup.py sdist bdist_wheel
twine upload dist/*
Parallel Representations
- ReadAllLexicons: Processes the lexicon file.
- SanityCheck: Ensures the data is valid and well-organized.
- ReadRawText: Invokes the SanityCheck function to return pure text data and class labels.
- setSpellChecking: Sets up the spellchecker. Note: If you wish to use a custom exclusion file, you must specify your exclusion file in the downstream function call.
- TextToFeatures: [Add description here]
- TextToFeaturesReader: [Add description here]
- RunFeatureConstruction: [Add description here]
- ConstructLegomena: [Add description here]
- BuildFeatureVector: [Add description here]
- VectorProcessor: [Add description here]
- ResultWriter: [Add description here]
- runVader: [Add description here]
- GenerateColumnKey: [Add description here]
Graph-based Feature Weighting (AFRN)
- HashLetters: [Add description here]
- ReadFeatures: [Add description here]
- ReadTrain: [Add description here]
- AssignTrainWeights: [Add description here]
- ReadSentiScores: [Add description here]
- ReadLex: [Add description here]
- NGramSemantic: [Add description here]
- AssignSemanticWeights: [Add description here]
- POSSemantic: [Add description here]
- POSWordSemantic: [Add description here]
- LEXSemantic: [Add description here]
- MatchCharSubstrings: [Add description here]
- MatchSubstrings: [Add description here]
- SubsumeCatN: [Add description here]
- SubsumeFeatures: [Add description here]
- RunSubsumptions: [Add description here]
- LoadHash: [Add description here]
- RunCCSubsumptions: [Add description here]
- RunParallels: [Add description here]
- ParallelCatN: [Add description here]
- ParaLex: [Add description here]
- Correlation: [Add description here]
- ParaPOS: [Add description here]
- OutputRankings: [Add description here]
- AFRN: [Add description here]
Additional Considerations
Installation
- Package versions needed (execution will stop via a check; will add requirements.txt in the future):
- wn 0.0.23
- For SpaCy, run the following to get the 'en_core_web_sm' model ('en' in SpaCy 2.3.5):
python -m spacy download en_core_web_sm
-
For the spellchecker (which defaults to aspell):
- MacOS: brew install enchant
- Windows: pyenchant includes hunspell out of the box
- Linux: install libenchant via package manager
- For general notes, see: https://pyenchant.github.io/pyenchant/install.html
-
For NLTK dependencies (e.g., list of vader_lexicon), use the provided script after installing NLTK:
python install-dependencies.py
Running Textagon
- For a demo or to test the installation, use: python cgi-bin/processText-serverModel.py
- From the main folder, for a file called 'dvd.txt' use: python cgi-bin/processText-serverModel.py upload/dvd.txt output 0 0 4 3 upload/FRNLexicons_v4.zip 1 5 bB 0 1 0 3 1 1 1 1 upload/exclusions.txt full > logs/output.log
- Change the name of the output and log file from 'output' and 'output.log' to whatever you prefer, respectively.
- To see on-screen output, remove the pipe to the log (i.e., delete ' > logs/output.log').
- In addition, for a full run (feature + matrix), the final argument should be 'full' as shown above. To run just one stage, replace 'full' with either 'feature' or 'matrix' depending on what you need.
- Beyond 'full', 'feature' and 'matrix', you can also use 'representation' mode to run 'feature' and only the relevant parts of 'matrix' to produce a representation zip file. Alternatively, use 'featuretorep' after performing a 'feature' run, use 'representation' to generate the associated zip file.
- In terms of settings, the key aspects are in the first sequence after output: 0 0 4 3. The 4 here is the n-gram length, while 3 is the maximum number of cores to use.
- The format of the command arguments will be improved in the next release and a help command will be added.
- See script.sh for a working command example (make sure to use chmod +x to run it). Similarly, script.bat provides a Windows example, but also includes a way to do benchmarking via mprof (pip install memory-profiler).
Misc
- In the examples, exclusions.txt is always used, which contains a number of drug names to be ignored by the spellchecker (failing to exclude these will lead to a variety of innaccurate spell checker "fixes").
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textagon-0.1.23.tar.gz.
File metadata
- Download URL: textagon-0.1.23.tar.gz
- Upload date:
- Size: 18.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.8 Linux/6.11.0-19-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9505301789712e8908f2696fa098c0720d53c16a57293badc09585b7c8dad0cb
|
|
| MD5 |
f4d674de4625f5b667da37ab1295004d
|
|
| BLAKE2b-256 |
484d410fe8f1491cb7e217e011e41753974f12409b37eb6f6eef08fcba898d7e
|
File details
Details for the file textagon-0.1.23-py3-none-any.whl.
File metadata
- Download URL: textagon-0.1.23-py3-none-any.whl
- Upload date:
- Size: 18.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.8 Linux/6.11.0-19-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffca141250170f770992d140ca2cb4c3e235015efd01d9cfdde3318478a9238d
|
|
| MD5 |
f751b93b3f0c095565f4c8fcaa1f0e19
|
|
| BLAKE2b-256 |
97c1dde9e05c83571b35d9ed3702267ad3b232241389f8ca1fe67b74d92c9e00
|