Skip to content

Commit

Permalink
Merge pull request #4 from bkolosk1/master
Browse files Browse the repository at this point in the history
Version Bump to Py 11.
  • Loading branch information
SkBlaz authored Jan 3, 2025
2 parents f08a22f + e388318 commit 0c0ae6e
Show file tree
Hide file tree
Showing 19 changed files with 258 additions and 56 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip;
pip install autobotlib;
pip install .;
- name: Analysing the code with pylint
run: |
python -m nltk.downloader stopwords;python -m nltk.downloader punkt;
python -m nltk.downloader averaged_perceptron_tagger;
bash cli_example.sh;
8 changes: 3 additions & 5 deletions .github/workflows/core-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install autobotlib
pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -33,6 +33,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m nltk.downloader stopwords;python -m nltk.downloader punkt;
python -m nltk.downloader averaged_perceptron_tagger;
cd tests; py.test;
10 changes: 6 additions & 4 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Py 3.9
name: Py 3.11

on: [push]

Expand All @@ -9,11 +9,13 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9

- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install autobotlib
pip install .
171 changes: 171 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# 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

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.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

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__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/

# PyPI configuration file
.pypirc
5 changes: 5 additions & 0 deletions autoBOTLib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
from autoBOTLib.optimization.optimization_engine import *
from autoBOTLib.misc.misc_helpers import *

import nltk
nltk.download('stopwords')
nltk.download('punkt_tab')
nltk.download('averaged_perceptron_tagger_eng')

import os
import logging

Expand Down
6 changes: 3 additions & 3 deletions autoBOTLib/features/features_concepts.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ def transform(self, text_vector, use_conc_docs=False):
text_vector = self.get_propositionalized_rep(text_vector)
return self.concept_vectorizer.transform(text_vector)

def get_feature_names(self):
def get_feature_names_out(self):

return self.concept_vectorizer.get_feature_names()
return self.concept_vectorizer.get_feature_names_out()

def fit_transform(self, text_vector, b=None):
"""
Expand All @@ -265,7 +265,7 @@ def fit_transform(self, text_vector, b=None):
labels = example_text['label']
rex = ConceptFeatures(knowledge_graph="./memory")
m = rex.fit_transform(text)
fnames = rex.get_feature_names()
fnames = rex.get_feature_names_out()

m = m.todense()
dataframe = pd.DataFrame(m)
Expand Down
2 changes: 1 addition & 1 deletion autoBOTLib/features/features_contextual.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def fit_transform(self, documents, b=None):
"""
return self.transform(documents)

def get_feature_names(self):
def get_feature_names_out(self):
"""
:param fnames: Feature names (custom api artefact)
"""
Expand Down
4 changes: 2 additions & 2 deletions autoBOTLib/features/features_document_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def fit(self, text_list):

self.core_documents = t_tokens
self.G = self.get_graph(nlist, len(text_list))
G = nx.to_scipy_sparse_matrix(self.G,
G = nx.to_scipy_sparse_array(self.G,
nodelist=list(range(len(text_list))))

if self.verbose:
Expand Down Expand Up @@ -181,7 +181,7 @@ def fit_transform(self, documents, b=None):
self.fit(documents)
return self.transform(documents)

def get_feature_names(self):
def get_feature_names_out(self):
return list(["dim_" + str(x) for x in range(self.ndim)])

def get_graph(self, wspace, ltl):
Expand Down
2 changes: 1 addition & 1 deletion autoBOTLib/features/features_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def fit_transform(self, documents, b=None):
"""
return self.transform(documents)

def get_feature_names(self):
def get_feature_names_out(self):
"""
:param fnames: Feature names (custom api artefact)
"""
Expand Down
6 changes: 3 additions & 3 deletions autoBOTLib/features/features_keyword.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def transform(self, text_vector):

return self.keyword_vectorizer.transform(text_vector)

def get_feature_names(self):
def get_feature_names_out(self):

return self.keyword_vectorizer.get_feature_names()
return self.keyword_vectorizer.get_feature_names_out()

def fit_transform(self, text_vector, b=None):
"""
Expand All @@ -147,7 +147,7 @@ def fit_transform(self, text_vector, b=None):
rex = KeywordFeatures(targets=labels, max_features=512)
rex.fit(text)
m = rex.transform(text)
feature_names = rex.get_feature_names()
feature_names = rex.get_feature_names_out()

m = m.todense()
dfx = pd.DataFrame(m)
Expand Down
2 changes: 1 addition & 1 deletion autoBOTLib/features/features_sentence_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def transform(self, text_vector):

return sparse.csr_matrix(final_matrix)

def get_feature_names(self):
def get_feature_names_out(self):

return [str(x) + "_" + str(self.dm) for x in list(range(self.ndim))]

Expand Down
2 changes: 1 addition & 1 deletion autoBOTLib/features/features_token_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def fit(self, text_vector, b=None):
if enx in sorted_correlations
]

def get_feature_names(self):
def get_feature_names_out(self):
"""
Return exact feature names.
"""
Expand Down
2 changes: 1 addition & 1 deletion autoBOTLib/features/features_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def fit_transform(self, documents, b=None):
self.fit(documents)
return self.transform(documents)

def get_feature_names(self):
def get_feature_names_out(self):
"""
Get feature names.
"""
Expand Down
Loading

0 comments on commit 0c0ae6e

Please sign in to comment.