Skip to content

Commit

Permalink
Merge pull request #140 from ku-nlp/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nobu-g authored Aug 17, 2023
2 parents cdc5015 + 172b3f8 commit 73c62e2
Show file tree
Hide file tree
Showing 60 changed files with 1,509 additions and 1,084 deletions.
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily" # TODO: Change to "monthly"
interval: "weekly" # TODO: Change to "monthly"
timezone: "Asia/Tokyo"
target-branch: "develop"
ignore:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build

on: [push, pull_request]

jobs:
build:
name: Build the project
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 15
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
pipx install poetry
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry install --no-interaction --without dev,test,docs
- name: Build package
run: |
poetry build
- name: Install rhoknp from wheel (non-Windows)
if: ${{ matrix.os != 'windows-latest' }}
run: |
wheelFile=$(ls dist/*.whl)
pip3 install ${wheelFile}[cli]
- name: Install rhoknp from wheel (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
$wheelFile = (Get-ChildItem -Path dist -Filter *.whl).FullName
pip3 install "${wheelFile}[cli]"
shell: pwsh
- name: Run rhoknp
run: |
rhoknp --version
rhoknp --help
4 changes: 2 additions & 2 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
uses: lewagon/wait-on-check-action@v1.3.1
with:
ref: ${{ github.event.pull_request.head.sha }}
running-workflow-name: "Test" # the name of the required check
# check-regexp: Run tests with pytest.* # this condition is also possible
# running-workflow-name: "Test" # this condition does not work
check-regexp: Run tests with pytest.*
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 60 # Check every 60 seconds
- name: Enable auto-merge for Dependabot PRs
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ jobs:
python3 -m pipx ensurepath
python3 -m pipx install poetry
- name: Add path for Python packages
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install --no-interaction --without dev,docs --extras=cli
- name: Cache KWJA checkpoints
uses: actions/cache@v3
with:
path: /tmp/kwja
key: kwja-${{ env.KWJA_VERSION }}
- name: Run tests with KWJA
run: |
poetry install --no-interaction --without dev,docs --extras=cli
- name: Install KWJA
# KWJA does not support Python 3.7
if: ${{ matrix.python-version != 3.7 }}
run: |
pipx install kwja
- name: Run tests with coverage
if: ${{ matrix.python-version == 3.9 }}
run: |
poetry run pytest --cov=./ --cov-report=xml -v ./tests
- name: Run tests without KWJA
if: ${{ matrix.python-version == 3.7 }}
- name: Run tests without coverage
if: ${{ matrix.python-version != 3.9 }}
run: |
poetry run pytest -v --ignore ./tests/processors/test_kwja.py ./tests
poetry run pytest -v ./tests
- name: Upload coverage to Codecov
if: ${{ matrix.python-version == 3.9 }}
uses: codecov/codecov-action@v3
Expand Down
18 changes: 12 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ repos:
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [Flake8-pyproject]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
Expand All @@ -25,7 +26,7 @@ repos:
hooks:
- id: absolufy-imports
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies:
Expand All @@ -34,9 +35,9 @@ repos:
- rich
- uvicorn
- fastapi
- markdown-it-py==2.2.0
- markdown-it-py==2.2.0 # markdown-it-py 3.0.0 requires Python 3.8+
- repo: https://github.com/asottile/pyupgrade
rev: v3.6.0
rev: v3.10.1
hooks:
- id: pyupgrade
args:
Expand All @@ -46,6 +47,11 @@ repos:
hooks:
- id: pydocstyle
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
rev: v3.0.2
hooks:
- id: prettier
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.32.1
hooks:
- id: djlint-jinja
- id: djlint-reformat-jinja
4 changes: 2 additions & 2 deletions examples/use_coreference_resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$ python examples/use_coreference_resolution.py "ソビエト連邦はソ連ともよばれる。同国の首都はモスクワである。"
"""
import sys
from typing import Set
from typing import List

from rhoknp import KWJA, BasePhrase

Expand All @@ -16,7 +16,7 @@

# Get information.
for base_phrase in doc.base_phrases:
coreferents: Set[BasePhrase] = base_phrase.get_coreferents()
coreferents: List[BasePhrase] = base_phrase.get_coreferents()
if len(coreferents) > 0:
print(f"Mention {base_phrase}")
for coreferring_mention in coreferents:
Expand Down
2 changes: 1 addition & 1 deletion examples/use_discourse_relation_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
sent = knp.apply_to_sentence(sys.argv[1])

# Get information.
if sent.need_clause_tag is True:
if sent.is_clause_tag_required is True:
print("KNP might be too old; please update it.")
sys.exit(1)

Expand Down
2 changes: 1 addition & 1 deletion examples/use_predicate_argument_structure_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Get information.
for base_phrase in sent.base_phrases:
pas = base_phrase.pas
if pas.is_empty is True:
if pas.is_empty() is True:
continue
all_arguments: Dict[str, List[Argument]] = pas.get_all_arguments()
print(f"Predicate: {pas.predicate}")
Expand Down
Loading

0 comments on commit 73c62e2

Please sign in to comment.