diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 12:48:57 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 12:48:57 +0000 |
commit | c570734257df3e36b87fc00e333f86da39896753 (patch) | |
tree | 1ab784ff85846ae636cde6f5bbd6be39056825c0 | |
parent | 8dccd0ab272a69657118fce466d60d7ca45525da (diff) |
automatic import of python-yargyopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-yargy.spec | 505 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 507 insertions, 0 deletions
@@ -0,0 +1 @@ +/yargy-0.15.1.tar.gz diff --git a/python-yargy.spec b/python-yargy.spec new file mode 100644 index 0000000..584366b --- /dev/null +++ b/python-yargy.spec @@ -0,0 +1,505 @@ +%global _empty_manifest_terminate_build 0 +Name: python-yargy +Version: 0.15.1 +Release: 1 +Summary: Rule-based facts extraction for Russian language +License: MIT +URL: https://github.com/natasha/yargy +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/04/05/aa9af6c2b4e8cf4f96ceb04a7d3bc9224837959a643f92403c915cb6ce50/yargy-0.15.1.tar.gz +BuildArch: noarch + +Requires: python3-pymorphy2 + +%description +<img src="https://github.com/natasha/natasha-logos/blob/master/yargy.svg"> + + + +Yargy uses rules and dictionaries to extract structured information from Russian texts. Yargy is similar to <a href="https://yandex.ru/dev/tomita">Tomita parser</a>. + +## Install + +Yargy supports Python 3.7+, PyPy 3, depends only on <a href="http://github.com/pymorphy2/pymorphy2">Pymorphy2</a>. + +```bash +$ pip install yargy +``` + +## Usage + +```python +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='Ульянов' + ) +) + +``` + +## Documentation + +All materials are in Russian: + +* <a href="https://habr.com/ru/post/349864/">Overview</a> +* <a href="https://www.youtube.com/watch?v=NQxzx0qYgK8">Video from workshop</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/index.ipynb">Getting started</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/ref.ipynb">Reference</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/cookbook.ipynb">Cookbook</a> +* <a href="https://github.com/natasha/yargy-examples">Examples</a> +* <a href="https://github.com/natasha/natasha-usage#yargy">Code snippets</a> + +## Support + +- Chat — https://t.me/natural_language_processing +- Issues — https://github.com/natasha/yargy/issues +- Commercial support — https://lab.alexkuk.ru + +## Development + +Dev env + +```bash +pyenv virtualenv 3.11.0 natasha-yargy +pyenv activate natasha-yargy + +pip install -r requirements/dev.txt +pip install -e . + +pyenv virtualenv-delete natasha-yargy +``` + +Test + lint + +```bash +make test +``` + +Update docs + +```bash +make exec-docs + +# Manually check git diff docs/, commit +``` + +Release + +```bash +# Update setup.py version + +git commit -am 'Up version' +git tag v0.15.1 + +git push +git push --tags + +# Github Action builds dist and publishes to PyPi +``` + + +%package -n python3-yargy +Summary: Rule-based facts extraction for Russian language +Provides: python-yargy +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-yargy +<img src="https://github.com/natasha/natasha-logos/blob/master/yargy.svg"> + + + +Yargy uses rules and dictionaries to extract structured information from Russian texts. Yargy is similar to <a href="https://yandex.ru/dev/tomita">Tomita parser</a>. + +## Install + +Yargy supports Python 3.7+, PyPy 3, depends only on <a href="http://github.com/pymorphy2/pymorphy2">Pymorphy2</a>. + +```bash +$ pip install yargy +``` + +## Usage + +```python +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='Ульянов' + ) +) + +``` + +## Documentation + +All materials are in Russian: + +* <a href="https://habr.com/ru/post/349864/">Overview</a> +* <a href="https://www.youtube.com/watch?v=NQxzx0qYgK8">Video from workshop</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/index.ipynb">Getting started</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/ref.ipynb">Reference</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/cookbook.ipynb">Cookbook</a> +* <a href="https://github.com/natasha/yargy-examples">Examples</a> +* <a href="https://github.com/natasha/natasha-usage#yargy">Code snippets</a> + +## Support + +- Chat — https://t.me/natural_language_processing +- Issues — https://github.com/natasha/yargy/issues +- Commercial support — https://lab.alexkuk.ru + +## Development + +Dev env + +```bash +pyenv virtualenv 3.11.0 natasha-yargy +pyenv activate natasha-yargy + +pip install -r requirements/dev.txt +pip install -e . + +pyenv virtualenv-delete natasha-yargy +``` + +Test + lint + +```bash +make test +``` + +Update docs + +```bash +make exec-docs + +# Manually check git diff docs/, commit +``` + +Release + +```bash +# Update setup.py version + +git commit -am 'Up version' +git tag v0.15.1 + +git push +git push --tags + +# Github Action builds dist and publishes to PyPi +``` + + +%package help +Summary: Development documents and examples for yargy +Provides: python3-yargy-doc +%description help +<img src="https://github.com/natasha/natasha-logos/blob/master/yargy.svg"> + + + +Yargy uses rules and dictionaries to extract structured information from Russian texts. Yargy is similar to <a href="https://yandex.ru/dev/tomita">Tomita parser</a>. + +## Install + +Yargy supports Python 3.7+, PyPy 3, depends only on <a href="http://github.com/pymorphy2/pymorphy2">Pymorphy2</a>. + +```bash +$ pip install yargy +``` + +## Usage + +```python +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='Ульянов' + ) +) + +``` + +## Documentation + +All materials are in Russian: + +* <a href="https://habr.com/ru/post/349864/">Overview</a> +* <a href="https://www.youtube.com/watch?v=NQxzx0qYgK8">Video from workshop</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/index.ipynb">Getting started</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/ref.ipynb">Reference</a> +* <a href="https://nbviewer.jupyter.org/github/natasha/yargy/blob/master/docs/cookbook.ipynb">Cookbook</a> +* <a href="https://github.com/natasha/yargy-examples">Examples</a> +* <a href="https://github.com/natasha/natasha-usage#yargy">Code snippets</a> + +## Support + +- Chat — https://t.me/natural_language_processing +- Issues — https://github.com/natasha/yargy/issues +- Commercial support — https://lab.alexkuk.ru + +## Development + +Dev env + +```bash +pyenv virtualenv 3.11.0 natasha-yargy +pyenv activate natasha-yargy + +pip install -r requirements/dev.txt +pip install -e . + +pyenv virtualenv-delete natasha-yargy +``` + +Test + lint + +```bash +make test +``` + +Update docs + +```bash +make exec-docs + +# Manually check git diff docs/, commit +``` + +Release + +```bash +# Update setup.py version + +git commit -am 'Up version' +git tag v0.15.1 + +git push +git push --tags + +# Github Action builds dist and publishes to PyPi +``` + + +%prep +%autosetup -n yargy-0.15.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-yargy -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.15.1-1 +- Package Spec generated @@ -0,0 +1 @@ +0e8436b736d8320c81e4f385e41b6408 yargy-0.15.1.tar.gz |