Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Vu Anh committed Jun 9, 2024
1 parent 8fee5e9 commit e7021fe
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 6 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci-pipe-langdetect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
pull_request:
branches: [ main ]
types:
- labeled
- synchronize

jobs:
ci-prompt:
runs-on: ubuntu-latest
steps:
- name: Get PR Labels
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_LABELS=$(gh pr view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json labels --jq '[.labels[].name]')
echo "$PR_LABELS"
echo "PR_LABELS=$PR_LABELS" >> $GITHUB_ENV
- name: Checkout
if: contains(env.PR_LABELS, 'ci-langdetect')
uses: actions/checkout@v2
- name: Set up Python 3.7
if: contains(env.PR_LABELS, 'ci-langdetect')
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
if: contains(env.PR_LABELS, 'ci-langdetect')
run: |
python -m pip install --upgrade pip
pip install pytest tox
- name: Run Test
if: contains(env.PR_LABELS, 'ci-prompt')
run: |
tox -e langdetect
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ Lang Detect API. Thanks to awesome work from [FastText](https://fasttext.cc/docs
Install extend dependencies and models

```bash
$ pip install underthesea[lang-detect]
$ pip install underthesea[langdetect]
```

Usage examples in script
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
'prompt': [
'openai'
],
'lang-detect': [
'fasttext '
'langdetect': [
'fasttext'
]
}
setup(
Expand Down
22 changes: 19 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,24 @@ setenv =
OPENAI_API_KEY = {env:OPENAI_API_KEY:}

commands =
; Modules with deep learning
; Modules with prompt
pip install -e .[prompt]

; ner module
python -m unittest tests.pipeline.classification.test_prompt
; prompt module
python -m unittest tests.pipeline.classification.test_prompt

[testenv:langdtect]
basepython = python3.7
deps=
pip>=20.3

setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/underthesea
OPENAI_API_KEY = {env:OPENAI_API_KEY:}

commands =
; Modules with prompt
pip install -e .[langdetect]

; prompt module
python -m unittest tests.pipeline.lang_detect.test_lang_detect.py

0 comments on commit e7021fe

Please sign in to comment.