diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a5ba0ac..bbf4b88 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,12 +1,15 @@ # Pull Request + ## Checklist + - [ ] 해당 PR 관련 이슈가 작성되었나요? - [ ] 테스트 코드를 작성하였나요? - [ ] 기존에 작성된 테스트코드가 정상적으로 작동하나요? (`tests/test*.py`) ## 1. 해당 PR은 어떤 내용인가요? + ## 2. PR과 관련된 이슈가 있나요? - + diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 539f059..292260f 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -5,35 +5,34 @@ name: Pytest # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: - pull_request: - branches: - - master - - dev - - refactoring + pull_request: + branches: + - master + - dev + - refactoring # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - Pytest: - # The type of runner that the job will run on - runs-on: ubuntu-latest - strategy: - matrix: - python-version: - - 3.x - timeout-minutes: 60 + Pytest: + # The type of runner that the job will run on + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - 3.x + timeout-minutes: 60 - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Prerequeist - run: | - pip3 install --upgrade pip setuptools - pip3 install pytest pytest-cov --no-cache --user - pip3 install -r requirements.txt --user - - name: test with pytest - run: python3 -m pytest -s -v --cov-report=xml --cov=./ tests/test*.py + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Prerequeist + run: | + pip3 install --upgrade pip setuptools + pip3 install pytest pytest-cov --no-cache --user + pip3 install -r requirements.txt --user + - name: test with pytest + run: python3 -m pytest -s -v --cov-report=xml --cov=./ tests/test*.py diff --git a/.gitignore b/.gitignore index 6769e21..68bc17f 100644 --- a/.gitignore +++ b/.gitignore @@ -157,4 +157,4 @@ cython_debug/ # 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/ \ No newline at end of file +#.idea/ diff --git a/README.md b/README.md index aee568b..503182c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ # soynlp -Renewing ... \ No newline at end of file +Renewing ... + +## Install + +``` +pipx install poetry==1.8.0 +poetry install +``` diff --git a/data/loader.py b/data/loader.py index 2e5ae1e..695e568 100644 --- a/data/loader.py +++ b/data/loader.py @@ -1,14 +1,13 @@ import os from glob import glob - installpath = os.path.abspath(os.path.dirname(__file__)) -def load(idx='134963', mode='norm', max_samples=-1): +def load(idx="134963", mode="norm", max_samples=-1): """ Args: - idx: str + idx: str movie idx mode: str `mode` = 'norm' or not @@ -21,17 +20,16 @@ def load(idx='134963', mode='norm', max_samples=-1): scores: list of int Annotated scores """ - suffix = '' if mode != 'norm' else '_norm' - paths = glob(f'{installpath}/{idx}{suffix}.txt') + suffix = "" if mode != "norm" else "_norm" + paths = glob(f"{installpath}/{idx}{suffix}.txt") if not paths: - raise ValueError(f'Not found file. Check idx {idx}') - with open(paths[0], encoding='utf-8') as f: + raise ValueError(f"Not found file. Check idx {idx}") + with open(paths[0], encoding="utf-8") as f: docs = [line.strip() for line in f] - docs = [line.rsplit('\t', 1) for line in docs] + docs = [line.rsplit("\t", 1) for line in docs] docs = [row for row in docs if len(row) == 2] if max_samples > 0: docs = docs[:max_samples] texts, scores = zip(*docs) scores = [int(s) for s in scores] return texts, scores -