Commit 3f8e23af by Jaime Collado

Dependencies, spacy corpus and pyproject.toml update

parent a3baf163
__pycache__
*.pyc
.ipynb_checkpoints
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
\ No newline at end of file
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 1,
"id": "5745bcf4",
"metadata": {},
"outputs": [],
......@@ -21,7 +21,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 2,
"id": "63c5bfcb",
"metadata": {},
"outputs": [
......@@ -31,7 +31,7 @@
"'Veo que en este foro, afortunadamente para vosotros, no hay mucha gente que sufra de TOC.Si hay alguien por ahí, me gustaría que compartiérais vuestras opiniones, yo compruebo las cosas que hago porque tengo miedo de haberme equivocado y pienso en las consecuencias que ese error podría acarrearme, y las compruebo una y otra vez, y esto me angustia.\\nSé que abrí un post parecido hace tiempo, pero ya quedó abajo y por tanto en el olvido, por eso abro este por si alguna persona nueva con este problema lo lee.Me gustaría saber qué os recetan a vosotros para esto y si os va bien.\\n\\nSaludos.\\nNereida.'"
]
},
"execution_count": 7,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
......@@ -58,11 +58,54 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 3,
"id": "52fd5e8e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting es-core-news-sm==3.2.0\n",
" Downloading https://github.com/explosion/spacy-models/releases/download/es_core_news_sm-3.2.0/es_core_news_sm-3.2.0-py3-none-any.whl (14.0 MB)\n",
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.0/14.0 MB 48.3 MB/s eta 0:00:00\n",
"Requirement already satisfied: spacy<3.3.0,>=3.2.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from es-core-news-sm==3.2.0) (3.2.3)\n",
"Requirement already satisfied: pathy>=0.3.5 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (0.6.1)\n",
"Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (1.0.6)\n",
"Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (3.0.6)\n",
"Requirement already satisfied: requests<3.0.0,>=2.13.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (2.27.1)\n",
"Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (2.0.7)\n",
"Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.8 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (3.0.9)\n",
"Requirement already satisfied: typer<0.5.0,>=0.3.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (0.4.0)\n",
"Requirement already satisfied: setuptools in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (61.0.0)\n",
"Requirement already satisfied: packaging>=20.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (21.3)\n",
"Requirement already satisfied: jinja2 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (3.0.3)\n",
"Requirement already satisfied: blis<0.8.0,>=0.4.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (0.7.7)\n",
"Requirement already satisfied: srsly<3.0.0,>=2.4.1 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (2.4.2)\n",
"Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (4.63.1)\n",
"Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (1.0.1)\n",
"Requirement already satisfied: wasabi<1.1.0,>=0.8.1 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (0.9.0)\n",
"Requirement already satisfied: thinc<8.1.0,>=8.0.12 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (8.0.15)\n",
"Requirement already satisfied: pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (1.8.2)\n",
"Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (2.0.6)\n",
"Requirement already satisfied: numpy>=1.15.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (1.22.3)\n",
"Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (3.3.0)\n",
"Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from packaging>=20.0->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (3.0.7)\n",
"Requirement already satisfied: smart-open<6.0.0,>=5.0.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from pathy>=0.3.5->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (5.2.1)\n",
"Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (4.1.1)\n",
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (1.26.9)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (2021.10.8)\n",
"Requirement already satisfied: charset-normalizer~=2.0.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (2.0.12)\n",
"Requirement already satisfied: idna<4,>=2.5 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (3.3)\n",
"Requirement already satisfied: click<9.0.0,>=7.1.1 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from typer<0.5.0,>=0.3.0->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (8.0.4)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in /home/jcollado/miniconda3/envs/text-analysis/lib/python3.9/site-packages (from jinja2->spacy<3.3.0,>=3.2.0->es-core-news-sm==3.2.0) (2.1.1)\n",
"Installing collected packages: es-core-news-sm\n",
"Successfully installed es-core-news-sm-3.2.0\n",
"\u001b[38;5;2m✔ Download and installation successful\u001b[0m\n",
"You can now load the package via spacy.load('es_core_news_sm')\n"
]
},
{
"data": {
"text/plain": [
"{'npunct': 13,\n",
......@@ -91,13 +134,17 @@
" 'crawford': 4.851558558558558}"
]
},
"execution_count": 8,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nlp = spacy.load(\"es_core_news_sm\")\n",
"try:\n",
" nlp = spacy.load(\"es_core_news_sm\")\n",
"except:\n",
" spacy.cli.download(\"es_core_news_sm\")\n",
" nlp = spacy.load(\"es_core_news_sm\")\n",
"\n",
"ca = ComplexityAnalyzer(\"es\", nlp)\n",
"\n",
......
This diff could not be displayed because it is too large.
[build-system]
requires = [
"setuptools>=42",
"wheel",
"spacy",
"lexical-diversity",
"syllables",
"transformers",
"pandas",
"numpy",
"matplotlib",
"tqdm",
"seaborn",
"nltk",
"es-core-news-sm"
[tool.poetry]
name = "texty"
version = "0.1.0"
description = "Text analysis and processing package"
authors = [
"Alba María Mármol <ammarmol@ujaen.es>",
"Arturo Montejo-Ráez <amontejo@ujaen.es>",
"Jaime Collado-Montañez <jcollado@ujaen.es>"
]
license = "MIT"
readme = "README.md"
repository = "https://gitlab.ujaen.es/ammr0032/TextAnalysisSpacy"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
]
build-backend = "setuptools.build_meta"
\ No newline at end of file
packages = [
{ include = "texty", from = "src" },
]
[tool.poetry.dependencies]
python = "^3.8"
pandas = "^1.4.1"
spacy = "^3.2.3"
lexical-diversity = "^0.1.1"
syllables = "^1.0.3"
transformers = "^4.17.0"
numpy = "^1.22.3"
matplotlib = "^3.5.1"
tqdm = "^4.63.1"
seaborn = "^0.11.2"
nltk = "^3.7"
[tool.poetry.scripts]
analyze-complexity = "texty.analyze_complexity:analyze_complexity"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
......@@ -24,15 +24,19 @@ def analyze_complexity(args=None):
print("Error while reading the file")
exit()
# Instantiate Complexity class
# Instantiate the ComplexityAnalyzer class
try:
nlp = spacy.load("es_core_news_sm")
except:
spacy.cli.download("es_core_news_sm")
nlp = spacy.load("es_core_news_sm")
ca = ComplexityAnalyzer("es", nlp)
complexity_analyzer = ComplexityAnalyzer("es", nlp)
# Read file
ca.read("".join(lines))
complexity_analyzer.read("".join(lines))
# Calculate metrics
metrics = ca.get_all_metrics()
metrics = complexity_analyzer.get_all_metrics()
output_df = pd.DataFrame([metrics.values()], columns=metrics.keys())
if args.output == "csv":
......@@ -42,7 +46,7 @@ def analyze_complexity(args=None):
elif args.output == "json":
output_df.to_json("output.json")
print("Output file generated.")
print("Output file generated in the current directory.")
if __name__ == "__main__":
analyze_complexity()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment