Skip to content

Commit

Permalink
Merge pull request #119 from ku-nlp/develop
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
nobu-g authored May 1, 2023
2 parents 63e0b55 + 3fc6444 commit 413b901
Show file tree
Hide file tree
Showing 79 changed files with 831 additions and 558 deletions.
5 changes: 4 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
interval: "daily" # TODO: Change to "monthly"
timezone: "Asia/Tokyo"
target-branch: "develop"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]

- package-ecosystem: "github-actions"
# Workflow files stored in the
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '37 23 * * 0'
- cron: "37 23 * * 0"

jobs:
analyze:
Expand All @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: ["python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

Expand All @@ -52,7 +52,6 @@ jobs:
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
name: Dependabot auto-merge
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Wait for tests to pass
uses: lewagon/wait-on-check-action@v1
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: "Test" # Replace 'test' with the name of the required check
github-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 60 # Check every 60 seconds
- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Lint

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.7"
- name: Run linters
run: |
python3 -m pip install --user pre-commit
pipx install pre-commit
pre-commit run --all-files
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish

on:
release:
types: [ published ]
types: [published]

jobs:
build-publish:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*.*.*'
- "v*.*.*"

jobs:
build:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ name: TestExample

on:
schedule:
- cron: '0 3 */16 * *' # Runs at 3:00 UTC on the 1 and 17th of every month.
- cron: "0 3 */16 * *" # Runs at 3:00 UTC on the 1 and 17th of every month.
workflow_dispatch:

jobs:
test-example:
name: Run tests for examples
container: kunlp/jumanpp-knp:ubuntu
runs-on: ubuntu-20.04 # to meet the ubuntu version in the kunlp/jumanpp-knp:ubuntu container
runs-on: ubuntu-20.04 # to meet the ubuntu version in the kunlp/jumanpp-knp:ubuntu container
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install required apt packages
run: |
apt update -y
apt install -y curl build-essential libsqlite3-dev libffi-dev
DEBIAN_FRONTEND=noninteractive apt install -y curl build-essential libsqlite3-dev libffi-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}-dev
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
python3 -m pip install --user pipx
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
name: Test

on:
[ push, pull_request, workflow_dispatch ]
on: [push, pull_request, workflow_dispatch]

jobs:
test:
name: Run tests with pytest
container: kunlp/jumanpp-knp:ubuntu
runs-on: ubuntu-20.04 # to meet the ubuntu version in the kunlp/jumanpp-knp:ubuntu container
runs-on: ubuntu-20.04 # to meet the ubuntu version in the kunlp/jumanpp-knp:ubuntu container
strategy:
fail-fast: false
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install required apt packages
run: |
apt update -y
apt install -y curl build-essential libsqlite3-dev libffi-dev
DEBIAN_FRONTEND=noninteractive apt install -y curl build-essential libsqlite3-dev libffi-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}-dev
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
python3 -m pip install --user pipx
Expand Down
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
Expand All @@ -25,7 +25,7 @@ repos:
hooks:
- id: absolufy-imports
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.2.0
hooks:
- id: mypy
additional_dependencies:
Expand All @@ -35,7 +35,7 @@ repos:
- uvicorn
- fastapi
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.3.2
hooks:
- id: pyupgrade
args:
Expand All @@ -44,3 +44,7 @@ repos:
rev: 6.3.0
hooks:
- id: pydocstyle
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
6 changes: 3 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ build:
python: "3.9"

sphinx:
configuration: docs/conf.py
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
install:
- requirements: docs/requirements.txt
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Contributing to *rhoknp*
# Contributing to _rhoknp_

Thank you for your interest in improving *rhoknp*!
Our [contributing documentation](https://rhoknp.readthedocs.io/en/latest/contributing/index.html) contains what you need to know about contributing to *rhoknp*.
Thank you for your interest in improving _rhoknp_!
Our [contributing documentation](https://rhoknp.readthedocs.io/en/latest/contributing/index.html) contains what you need to know about contributing to _rhoknp_.
We look forward to your contributions!
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<a href="https://github.com/psf/black"><img alt="Code style - black" src="https://img.shields.io/badge/code%20style-black-222222?style=flat-square"></a>
</p>

*rhoknp* is a Python binding for [Juman++](https://github.com/ku-nlp/jumanpp), [KNP](https://github.com/ku-nlp/knp), and [KWJA](https://github.com/ku-nlp/kwja).[^1]
_rhoknp_ is a Python binding for [Juman++](https://github.com/ku-nlp/jumanpp), [KNP](https://github.com/ku-nlp/knp), and [KWJA](https://github.com/ku-nlp/kwja).[^1]

[^1]: The logo was originally generated using OpenAI DALL·E 2

Expand Down Expand Up @@ -64,7 +64,7 @@ pip install rhoknp

## Quick tour

Let's start with using Juman++ with *rhoknp*.
Let's start with using Juman++ with _rhoknp_.
Here is a simple example of using Juman++ to analyze a sentence.

```python
Expand Down Expand Up @@ -125,7 +125,7 @@ with open("sentence.knp", "rt") as f:
sentence = rhoknp.Sentence.from_knp(f.read())
```

*rhoknp* also provides APIs for document-level language analysis.
_rhoknp_ also provides APIs for document-level language analysis.

```python
document = rhoknp.Document.from_raw_text(
Expand Down Expand Up @@ -165,21 +165,21 @@ For more information, explore the [examples](./examples) and [documentation](htt

## Main differences from [pyknp](https://github.com/ku-nlp/pyknp/)

[*pyknp*](https://pypi.org/project/pyknp/) has been developed as the official Python binding for Juman++ and KNP.
In *rhoknp*, we redesigned the API from the top-down, taking into account the current use cases of *pyknp*.
[_pyknp_](https://pypi.org/project/pyknp/) has been developed as the official Python binding for Juman++ and KNP.
In _rhoknp_, we redesigned the API from the top-down, taking into account the current use cases of _pyknp_.
The main differences are as follows:

- **Support for document-level language analysis**: *rhoknp* can load and instantiate the result of document-level language analysis (i.e., cohesion analysis and discourse relation analysis).
- **Strictly type-aware**: *rhoknp* is thoroughly annotated with type annotations.
- **Extensive test suite**: *rhoknp* is tested with an extensive test suite. See the code coverage at [Codecov](https://app.codecov.io/gh/ku-nlp/rhoknp).
- **Support for document-level language analysis**: _rhoknp_ can load and instantiate the result of document-level language analysis (i.e., cohesion analysis and discourse relation analysis).
- **Strictly type-aware**: _rhoknp_ is thoroughly annotated with type annotations.
- **Extensive test suite**: _rhoknp_ is tested with an extensive test suite. See the code coverage at [Codecov](https://app.codecov.io/gh/ku-nlp/rhoknp).

## License

MIT

## Contributing

We welcome contributions to *rhoknp*.
We welcome contributions to _rhoknp_.
You can get started by reading the [contribution guide](https://rhoknp.readthedocs.io/en/latest/contributing/index.html).

## Reference
Expand Down
1 change: 1 addition & 0 deletions docs/authors.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
```{include} ../AUTHORS.md
```
4 changes: 2 additions & 2 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# CLI Tools

*rhoknp* provides a command-line interface (CLI).
_rhoknp_ provides a command-line interface (CLI).

Before using the CLI, you need to install *rhoknp* with the following command:
Before using the CLI, you need to install _rhoknp_ with the following command:

```{eval-rst}
.. prompt::
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributing

Thank you for your interest in improving *rhoknp*!
We give an overview on contributing to the *rhoknp* project.
Thank you for your interest in improving _rhoknp_!
We give an overview on contributing to the _rhoknp_ project.

## Development Environment

Expand Down
8 changes: 4 additions & 4 deletions docs/format/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ We show an example of the result of Juman++:
EOS
```

Each line represents a morpheme (a.k.a. *keitai-so*) and formatted as `[surface form] [reading] [lemma] [pos] [pos ID] [pos subcategory] [pos subcategory ID] [conjugation type] [conjugation type ID] [conjugation form] [conjugation form ID] [semantic information]`.
Each line represents a morpheme (a.k.a. _keitai-so_) and formatted as `[surface form] [reading] [lemma] [pos] [pos ID] [pos subcategory] [pos subcategory ID] [conjugation type] [conjugation type ID] [conjugation form] [conjugation form ID] [semantic information]`.
For example, `飲んだ のんだ 飲む 動詞 2 * 0 子音動詞マ行 9 タ形 10 "代表表記:飲む/のむ ドメイン:料理・食事"` indicates that the surface form is `飲んだ`, the reading is `のんだ`, the lemma is `飲む`, and the pos (part-of-speech) is `動詞`, and so forth.

## KNP
Expand Down Expand Up @@ -50,10 +50,10 @@ We show an example of the result of KNP:
EOS
```

The line starting with `*` represents the beginning of a phrase (a.k.a. *bunsetsu*) and formatted as `* [parent phrase index][dependency type] [semantic information]`.
The line starting with `*` represents the beginning of a phrase (a.k.a. _bunsetsu_) and formatted as `* [parent phrase index][dependency type] [semantic information]`.
For example, the line `* 3D <文頭><人名>` indicates that the phrase modifies the `3`rd phrase with the dependency type of `D` includes the semantic information of `<文頭>` and `<人名>`.

The line starting with `+` represents the beginning of a base-phrase (a.k.a. *kihon-ku*) and formatted as `+ [parent base-phrase index][dependency type] [semantic information]`.
The line starting with `+` represents the beginning of a base-phrase (a.k.a. _kihon-ku_) and formatted as `+ [parent base-phrase index][dependency type] [semantic information]`.
For example, the line `+ 1D <文節内><係:文節内>` indicates that the base-phrase modifies the `1`st base-phrase with the dependency type of `D` includes the semantic information of `<文節内>` and `<係:文節内>`.

Lines with neither `*` nor `+` represent morphemes.
Expand All @@ -68,4 +68,4 @@ The format is almost the same as Juman++'s one, except that the column of repres

## Reference

- [KNPの基本的な出力の読み方 (in Japanese)](http://cr.fvcrc.i.nagoya-u.ac.jp/~sasano/knp/format.html)
- [KNP の基本的な出力の読み方 (in Japanese)](http://cr.fvcrc.i.nagoya-u.ac.jp/~sasano/knp/format.html)
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# rhoknp: Yet another Python binding for Juman++/KNP/KWJA

[![Test](https://img.shields.io/github/actions/workflow/status/ku-nlp/rhoknp/test.yml?branch=main&logo=github&label=test&style=flat-square)](https://github.com/ku-nlp/rhoknp/actions/workflows/test.yml)
[![Codecov](https://img.shields.io/codecov/c/github/ku-nlp/rhoknp?logo=codecov&style=flat-square)](https://codecov.io/gh/ku-nlp/rhoknp)
[![CodeFactor](https://img.shields.io/codefactor/grade/github/ku-nlp/rhoknp?style=flat-square)](https://www.codefactor.io/repository/github/ku-nlp/rhoknp)
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you just would like to load the result of language analysis by Juman++ and KN

## Installation

We recommend installing *rhoknp* with pip:
We recommend installing _rhoknp_ with pip:

```{eval-rst}
.. prompt::
Expand Down
1 change: 1 addition & 0 deletions docs/reference/rhoknp.cli.cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
```

```{toctree}
```
1 change: 1 addition & 0 deletions docs/reference/rhoknp.cli.serve.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
```

```{toctree}
```
1 change: 1 addition & 0 deletions docs/reference/rhoknp.cli.show.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
```

```{toctree}
```
1 change: 1 addition & 0 deletions docs/reference/rhoknp.cli.stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
```

```{toctree}
```
1 change: 1 addition & 0 deletions docs/reference/rhoknp.cohesion.argument.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
```

```{toctree}
```
Loading

0 comments on commit 413b901

Please sign in to comment.