-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
59 additions
and
2 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,27 @@ | ||
clean: | ||
cargo clean | ||
find . | grep -E "(__pycache__|\.pyc|\.pyo$$)" | xargs rm -rf | ||
|
||
lint: | ||
black --check examples tests | ||
|
||
fmt: | ||
cargo fmt | ||
black examples/* tests/* | ||
|
||
.PHONY: tests | ||
test: | ||
cargo test | ||
python3 -m pytest tests | ||
|
||
develop: | ||
maturin develop --release | ||
|
||
build: | ||
maturin build -i python3 --release | ||
|
||
install: | ||
pip install . lindera_py | ||
|
||
uninstall: | ||
pip uninstall -y lindera_py |
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
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
Empty file.
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,23 @@ | ||
from pathlib import Path | ||
from lindera_py import Analyzer | ||
|
||
|
||
def test_analyze(): | ||
lindera_conf_path = Path("resources") / "lindera_ipadic_conf.json" | ||
analyzer = Analyzer(config_path=str(lindera_conf_path)) | ||
|
||
text = "Linderaは形態素解析エンジンです。ユーザー辞書も利用可能です。" | ||
|
||
# tokenize the text | ||
tokens = analyzer.analyze(text) | ||
|
||
assert tokens[0].text == "Lindera" | ||
assert tokens[1].text == "形態素" | ||
assert tokens[2].text == "解析" | ||
assert tokens[3].text == "エンジン" | ||
assert tokens[4].text == "ユーザ" | ||
assert tokens[5].text == "辞書" | ||
assert tokens[6].text == "利用" | ||
assert tokens[7].text == "可能" | ||
|
||
assert len(tokens) == 8 |