Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Comi committed Jan 9, 2023
2 parents a55d08f + 11088f0 commit d48e478
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "main", "test"]
pull_request:
branches: [ "main", "test"]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The [wget](https://www.gnu.org/software/wget/) tool is required for this package

## Installation
In order to install Z-BERT-A it is just needed to execute the following pip command which will make sure everything is accordingly installed.
Z-BERT-A uses spaCy with 'en_core_web_trf', this package will try to install it automatically itself if not present but make sure you have it installed through the suggested way of [spaCy](https://github.com/explosion/spaCy).

```console
pip install git+https://github.com/GT4SD/zberta.git
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ rich~=12.5.1
spacy~=3.4.0
setuptools~=60.2.0
sentence-transformers~=2.2.2
spacy-alignments~=0.8.5
spacy-alignments~=0.8.5
spacy-transformers
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ install_requires =
setuptools
sentence-transformers
spacy-alignments
keybert

[options.packages.find]
where = src
Expand Down
7 changes: 6 additions & 1 deletion src/zberta/intent_discovery/unknown_intents.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import spacy_transformers
import spacy
from spacy import displacy
import os
Expand All @@ -8,7 +9,11 @@

default_spacy = "en_core_web_trf"
os.system("python -m spacy download en_core_web_trf --no-deps")
nlp_engine = spacy.load("en_core_web_trf")
try:
nlp_engine = spacy.load("en_core_web_trf")
except:
os.system("python3 -m spacy download en_core_web_trf --no-deps")
nlp_engine = spacy.load("en_core_web_trf")
lemmatizer = WordNetLemmatizer()


Expand Down
2 changes: 2 additions & 0 deletions src/zberta/test/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_assertion():
assert True
2 changes: 2 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_assertion():
assert True

0 comments on commit d48e478

Please sign in to comment.