15
0
2025-05-13 08:48:53 +00:00
committed by Git OBS Bridge
commit 5860e9bd1e
6 changed files with 344 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

150
python-adapt-parser.changes Normal file
View File

@@ -0,0 +1,150 @@
-------------------------------------------------------------------
Tue May 13 06:53:02 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to pip-based build
-------------------------------------------------------------------
Tue Nov 7 09:58:56 UTC 2023 - Dominique Leuenberger <dimstar@opensuse.org>
- Fix build with RPM 4.19: unnumbered patches are no longer
supported.
-------------------------------------------------------------------
Wed Oct 19 11:27:15 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Fix sitelib in files section
-------------------------------------------------------------------
Wed Oct 19 10:59:31 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Add patch remove-python-six.patch to do not require python-six
- Remove python-six dependency
- Remove not needed deps:
* unittest-xml-reporting
* python-pyee
- Use pytest in check instead unittest
-------------------------------------------------------------------
Tue Nov 2 10:26:21 UTC 2021 - pgajdos@suse.com
- version update to 1.0.0
* Safe defaults #147
* Updated docstrings
* Fix is_prefix() implementation in Trie #148
* Python2 is officially supported
* Removed requirement of pyee
-------------------------------------------------------------------
Sat Oct 16 09:45:36 UTC 2021 - Dirk Müller <dmueller@suse.com>
- update to 0.6.1:
* Support for python 2.7 is now a firm thing and not just implied.
-------------------------------------------------------------------
Thu Sep 2 12:28:07 UTC 2021 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 0.5.1
* Publish to pypi from master after tagging
* Fix name of LICENSE file in MANIFEST (#140)
* Hard code Pypi user to __token__
* Add checks and bdist_wheel
* Split PR workflow from push workflow
* Add automatic tagging
* Remove old publish scripts
* Add support for publishing to pypi
- from version 0.5.0
* Guarantee sorted results from IntentDeterminationEngine.determine_intent (#137)
* Fixes issue 97 (#138)
- from version 0.4.3
* Updated docstrings, and some small fixes (#132)
* Bump version to 0.4.2
* Fix use after remove
* Test that a removed regexp can be re-added
* Fix storing regex as string when cleaned
- from version 0.4.1
* Scoring tests and fixes (#131)
* Issues/114 (#128)
* Add .envrc to git-ignore
* Consolidate requirements
* Remove unused requirement argparse
* Add license and readme to MANIFEST.in
* Use run_tests.sh in github actions
* Add run_tests.sh to easily do linting and tests
* Remove run_tests.py and add test instructions
* Add test requirements into test-requirements.txt
* Enable flake8 checks for some basic errors
* Drop use of Travis CI
* Drop support for Python 3.5
* Run unit tests in Github Actions
- from version 0.4.0
* Add support for dropping regex entities
* Drop nonlocal variables in scan
* Add support for dropping registered entities
* Add "scan" method to Trie
* Add basic tests for removing from Trie
* Add drop_intent tests
* Fix regex warnings
* Add functionality to drop intent parsers
* Add python 3.9 as a supported version
* Add python 3.9 to test suite
- from version 0.3.7
* Add readme
* Update to pyee 8.1.0
* chore(intent.py): fix typo in docstring
* chore(trie.py): fix typo in docstring
* chore(engine.py): correct include_tags's docstring
* Issue #109: unused imports/variable declarations
* Issue #109: unused imports/variable declarations
- from version 0.3.6
* Upgrade to the latest version of pyee
* Change the URL for more docs
- from version 0.3.5
* Issue #86
* Remove python 2.7-3.4 and add 3.6-8 from travis run
* Update engine.py (fix typos in docstring)
- Update BuildRequires and Requires from requirements.txt
- Update filename argument to %setup invocation
- Update sed filename argument from setup.py to requirements.txt
- Update testsuite invocation to `%python_exec setup.py test`
-------------------------------------------------------------------
Thu Jan 16 15:20:49 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- update to 0.3.4
* minor fixes
-------------------------------------------------------------------
Fri Jun 7 14:25:19 UTC 2019 - Marketa Calabkova <mcalabkova@suse.com>
- Update to 0.3.3
* Change license to Apache 2.0
* other minor changes
-------------------------------------------------------------------
Tue Mar 5 09:50:13 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Siwtch to unittest-xml-reporting
-------------------------------------------------------------------
Mon Mar 4 14:04:48 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 0.3.2:
* no upstream changelog
- Switch to github tarball for tests
-------------------------------------------------------------------
Tue Jan 9 11:56:54 UTC 2018 - alarrosa@suse.com
- Remove unneeded buildrequires
-------------------------------------------------------------------
Fri Nov 17 10:57:07 UTC 2017 - alarrosa@suse.com
- Don't force to require specific python module versions in requirements.txt,
but allow newer versions since TW usually updates quite often and
python-adapt-parser should continue working.
-------------------------------------------------------------------
Tue Sep 5 15:15:34 UTC 2017 - alarrosa@suse.com
- Initial release of adapt-parser 0.3.0

64
python-adapt-parser.spec Normal file
View File

@@ -0,0 +1,64 @@
#
# spec file for package python-adapt-parser
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-adapt-parser
Version: 1.0.0
Release: 0
Summary: A text-to-intent parsing framework
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/MycroftAI/adapt
Source: https://github.com/MycroftAI/adapt/archive/refs/tags/release/v%{version}.tar.gz
# PATCH-FIX-OPENSUSE remove-python-six.patch
Patch0: remove-python-six.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%description
The Adapt Intent Parser is a flexible and extensible intent definition and
determination framework. It is intended to parse natural language text into
a structured intent that can then be invoked programatically.
%prep
%autosetup -p1 -n adapt-release-v%{version}
sed -i -s "s/==/>=/" requirements.txt
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest test/*.py
%files %{python_files}
%license LICENSE.md
%doc README.md SUPPORT.md GETTING_STARTED.md
%{python_sitelib}/adapt
%{python_sitelib}/adapt_parser-%{version}*-info
%changelog

103
remove-python-six.patch Normal file
View File

@@ -0,0 +1,103 @@
Index: adapt-release-v1.0.0/adapt/context.py
===================================================================
--- adapt-release-v1.0.0.orig/adapt/context.py
+++ adapt-release-v1.0.0/adapt/context.py
@@ -16,8 +16,6 @@
"""
Context Management code for Adapt (where context ~= persistent session state).
"""
-from six.moves import xrange
-
__author__ = "seanfitz, Art McGee"
@@ -129,7 +127,7 @@ class ContextManager(object):
missing_entities = list(missing_entities)
context = []
- for i in xrange(max_frames):
+ for i in range(max_frames):
frame_entities = [entity.copy() for entity in self.frame_stack[i].entities]
for entity in frame_entities:
entity['confidence'] = entity.get('confidence', 1.0) / (2.0 + i)
Index: adapt-release-v1.0.0/adapt/entity_tagger.py
===================================================================
--- adapt-release-v1.0.0.orig/adapt/entity_tagger.py
+++ adapt-release-v1.0.0/adapt/entity_tagger.py
@@ -14,7 +14,6 @@
#
from adapt.tools.text.trie import Trie
-from six.moves import xrange
__author__ = 'seanfitz'
@@ -40,8 +39,8 @@ class EntityTagger(object):
Yields:
str: ?
"""
- for start_idx in xrange(len(tokens)):
- for end_idx in xrange(start_idx + 1, len(tokens) + 1):
+ for start_idx in range(len(tokens)):
+ for end_idx in range(start_idx + 1, len(tokens) + 1):
yield ' '.join(tokens[start_idx:end_idx]), start_idx
def _sort_and_merge_tags(self, tags):
@@ -85,7 +84,7 @@ class EntityTagger(object):
additional_sort = len(entities) > 0
context_entities = []
- for i in xrange(len(tokens)):
+ for i in range(len(tokens)):
part = ' '.join(tokens[i:])
for new_entity in self.trie.gather(part):
Index: adapt-release-v1.0.0/adapt/expander.py
===================================================================
--- adapt-release-v1.0.0.orig/adapt/expander.py
+++ adapt-release-v1.0.0/adapt/expander.py
@@ -13,8 +13,6 @@
# limitations under the License.
#
-from six.moves import xrange
-
__author__ = 'seanfitz'
@@ -211,14 +209,14 @@ class BronKerboschExpander(object):
"""
graph = SimpleGraph()
- for tag_index in xrange(len(tags)):
- for entity_index in xrange(len(tags[tag_index].get('entities'))):
+ for tag_index in range(len(tags)):
+ for entity_index in range(len(tags[tag_index].get('entities'))):
a_entity_name = graph_key_from_tag(tags[tag_index], entity_index)
tokens = self.tokenizer.tokenize(tags[tag_index].get('entities', [])[entity_index].get('match'))
for tag in tags[tag_index + 1:]:
start_token = tag.get('start_token')
if start_token >= tags[tag_index].get('start_token') + len(tokens):
- for b_entity_index in xrange(len(tag.get('entities'))):
+ for b_entity_index in range(len(tag.get('entities'))):
b_entity_name = graph_key_from_tag(tag, b_entity_index)
graph.add_edge(a_entity_name, b_entity_name)
@@ -238,7 +236,7 @@ class BronKerboschExpander(object):
# name entities
for tag in tags:
- for entity_index in xrange(len(tag.get('entities'))):
+ for entity_index in range(len(tag.get('entities'))):
node_name = graph_key_from_tag(tag, entity_index)
if not node_name in entities:
entities[node_name] = []
@@ -283,7 +281,7 @@ class BronKerboschExpander(object):
def end_token_index():
return max([t.get('end_token') for t in overlapping_spans])
- for i in xrange(len(tags)):
+ for i in range(len(tags)):
tag = tags[i]
if len(overlapping_spans) > 0 and end_token_index() >= tag.get('start_token'):

3
v1.0.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a5e122ae27437b9dec932ff6470463bb734e909e45e02b672fc47afdeed2861c
size 38342