-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
15 changed files
with
893 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
on: | ||
push: | ||
branches: [ GH-185 ] | ||
|
||
jobs: | ||
build: | ||
name: Build rust | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout master | ||
uses: actions/checkout@v1 | ||
- name: Set up Python 3.6 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.6 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python | ||
- name: Add poetry to path | ||
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH | ||
- name: Install package deps | ||
working-directory: ./extensions/underthesea_core | ||
run: | | ||
poetry install | ||
- name: Install latest nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
- name: Build Python package | ||
working-directory: ./extensions/underthesea_core | ||
run: poetry run maturin develop --release | ||
pypi-publish: | ||
needs: build | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.6, 3.7] | ||
os: [ubuntu-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install latest nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
- name: Install dependencies | ||
working-directory: ./extensions/underthesea_core | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry install | ||
- name: Build Python package | ||
working-directory: ./extensions/underthesea_core | ||
run: poetry run maturin build --release --no-sdist --strip --interpreter python${{ matrix.python-version }} | ||
- name: List wheels | ||
working-directory: ./extensions/underthesea_core | ||
run: find ./target/wheels/ | ||
- name: Install wheels | ||
working-directory: ./extensions/underthesea_core | ||
run: pip install target/wheels/underthesea_core*.whl | ||
- name: PyPi publish | ||
working-directory: ./extensions/underthesea_core | ||
env: | ||
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }} | ||
run: poetry run maturin publish --username __token__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "underthesea_core" | ||
version = "0.0.4-alpha.6" | ||
authors = ["Vu Anh <[email protected]>"] | ||
description = "Underthesea Core (fast & fun)" | ||
license = "GPL-3.0" | ||
edition = "2021" | ||
readme = "README.md" | ||
repository = "https://github.com/undertheseanlp/underthesea/" | ||
homepage = "https://github.com/undertheseanlp/underthesea/" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serde = { version = "1.0", features = [ "derive" ] } | ||
regex = "1" | ||
|
||
[dependencies.pyo3] | ||
version = "0.15.0" | ||
features = ["extension-module"] | ||
|
||
[lib] | ||
name = "underthesea_core" | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Underthesea Core (fast & fun) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from underthesea_core import CRFFeaturizer | ||
print("-------------------") | ||
print("Test underthesea_core") | ||
|
||
|
||
sentences = [ | ||
[["Chàng", "X"], ["trai", "X"], ["9X", "X"]], | ||
[["Khởi", "X"], ["nghiệp", "X"], ["từ", "X"]], | ||
[["trường", "X"], ["học", "X"], ["từ", "X"]] | ||
] | ||
feature_configs = [ | ||
"T[0]", "T[1]", "T[2]", | ||
"T[0,1].is_in_dict" | ||
] | ||
dictionary = set(["Chàng", "trai", "trường học"]) | ||
|
||
# print("Call featurizer function") | ||
# print(featurizer(sentences, feature_configs, dictionary)) | ||
|
||
print("Call CRFFeaturizer function") | ||
crf_featurizer = CRFFeaturizer(feature_configs, dictionary) | ||
print(crf_featurizer.process(sentences)) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[tool.poetry] | ||
name = "underthesea_core" | ||
version = "0.0.4-alpha.6" | ||
authors = ["Vu Anh <[email protected]>"] | ||
description = "Underthesea Core (fast & fun)" | ||
license = "GPL-3.0" | ||
readme = "README.md" | ||
repository = "https://github.com/undertheseanlp/underthesea/" | ||
homepage = "https://github.com/undertheseanlp/underthesea/" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.5" | ||
|
||
[tool.poetry.dev-dependencies] | ||
maturin = "==0.9.4" | ||
|
||
[build-system] | ||
requires = ["==0.9.4"] | ||
build-backend = "maturin" |
Oops, something went wrong.