yargy
1.0.0
Yargy는 규칙과 사전을 사용하여 러시아 텍스트에서 구조화 된 정보를 추출합니다. Yargy는 Tomita Parser와 유사합니다.
Yargy는 Python 3.7+를 지원하고 Pypy 3은 Pymorphy2에만 의존합니다.
$ pip install yargy from yargy import Parser , rule , and_ , not_
from yargy . interpretation import fact
from yargy . predicates import gram
from yargy . relations import gnc_relation
from yargy . pipelines import morph_pipeline
Name = fact (
'Name' ,
[ 'first' , 'last' ],
)
Person = fact (
'Person' ,
[ 'position' , 'name' ]
)
LAST = and_ (
gram ( 'Surn' ),
not_ ( gram ( 'Abbr' )),
)
FIRST = and_ (
gram ( 'Name' ),
not_ ( gram ( 'Abbr' )),
)
POSITION = morph_pipeline ([
'управляющий директор' ,
'вице-мэр'
])
gnc = gnc_relation ()
NAME = rule (
FIRST . interpretation (
Name . first
). match ( gnc ),
LAST . interpretation (
Name . last
). match ( gnc )
). interpretation (
Name
)
PERSON = rule (
POSITION . interpretation (
Person . position
). match ( gnc ),
NAME . interpretation (
Person . name
)
). interpretation (
Person
)
parser = Parser ( PERSON )
match = parser . match ( 'управляющий директор Иван Ульянов' )
print ( match )
Person (
position = 'управляющий директор' ,
name = Name (
first = 'Иван' ,
last = 'Ульянов'
)
)모든 자료는 러시아어로 사용됩니다.
Dev Env
brew install graphviz
python -m venv ~ /.venvs/natasha-yargy
source ~ /.venvs/natasha-yargy/bin/activate
pip install -r requirements/dev.txt
pip install -e .
python -m ipykernel install --user --name natasha-yargy테스트 + 보풀
make test문서를 업데이트하십시오
make exec-docs
# Manually check git diff docs/, commit풀어 주다
# Update setup.py version
git commit -am ' Up version '
git tag v0.16.0
git push
git push --tags
# Github Action builds dist and publishes to PyPi