PyRuSH 1.0.9__tar.gz → 1.0.10.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/MANIFEST.in +1 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PKG-INFO +12 -25
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH/PyRuSHSentencizer.py +10 -4
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH/StaticSentencizerFun.cpp +4550 -2600
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH/StaticSentencizerFun.pyx +56 -1
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH/__init__.py +1 -1
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH.egg-info/PKG-INFO +12 -25
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH.egg-info/SOURCES.txt +4 -1
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/pyproject.toml +2 -2
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/setup.cfg +3 -1
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/setup.py +2 -2
- pyrush-1.0.10.dev0/tests/test_PyRushSentencizer.py +117 -0
- pyrush-1.0.10.dev0/tests/test_Rush.py +120 -0
- pyrush-1.0.10.dev0/tests/test_Rush_w_Logger.py +100 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/LICENSE +0 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH/RuSH.py +0 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH.egg-info/dependency_links.txt +0 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH.egg-info/not-zip-safe +0 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH.egg-info/requires.txt +0 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/PyRuSH.egg-info/top_level.txt +0 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/README.rst +0 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/conf/rush_rules.tsv +0 -0
- {PyRuSH-1.0.9 → pyrush-1.0.10.dev0}/requirements.txt +0 -0
|
@@ -1,39 +1,26 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: PyRuSH
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.10.dev0
|
|
4
4
|
Summary: PyRuSH is the python implementation of RuSH (Rule-based sentence Segmenter using Hashing), which is originally developed using Java. RuSH is an efficient, reliable, and easy adaptable rule-based sentence segmentation solution. It is specifically designed to handle the telegraphic written text in clinical note. It leverages a nested hash table to execute simultaneous rule processing, which reduces the impact of the rule-base growth on execution time and eliminates the effect of rule order on accuracy.
|
|
5
5
|
Home-page: https://github.com/jianlins/PyRuSH
|
|
6
6
|
Author: Jianlin
|
|
7
7
|
Author-email: Jianlin <jianlinshi.cn@gmail.com>
|
|
8
|
-
License: MIT
|
|
9
|
-
|
|
10
|
-
Copyright (c) 2020 Jianlin Shi
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
in the Software without restriction, including without limitation the rights
|
|
15
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
furnished to do so, subject to the following conditions:
|
|
18
|
-
|
|
19
|
-
The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
copies or substantial portions of the Software.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
SOFTWARE.
|
|
29
|
-
|
|
8
|
+
License-Expression: MIT
|
|
30
9
|
Project-URL: Source, https://github.com/jianlins/PyRuSH
|
|
31
10
|
Keywords: PyRuSH,NLP,sentenczier,sentence segmentation
|
|
32
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
33
11
|
Classifier: Programming Language :: Python :: 3
|
|
34
12
|
Requires-Python: >=3.6
|
|
35
13
|
Description-Content-Type: text/x-rst
|
|
36
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: Cython
|
|
16
|
+
Requires-Dist: setuptools
|
|
17
|
+
Requires-Dist: spacy<3.8; python_version < "3.12"
|
|
18
|
+
Requires-Dist: spacy>=3.8; python_version >= "3.12"
|
|
19
|
+
Requires-Dist: PyFastNER>=1.0.8
|
|
20
|
+
Requires-Dist: quicksectx>=0.3.5
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: home-page
|
|
23
|
+
Dynamic: license-file
|
|
37
24
|
|
|
38
25
|
PyRuSH
|
|
39
26
|
=========
|
|
@@ -19,13 +19,13 @@ from spacy import Language
|
|
|
19
19
|
from spacy.pipeline import Sentencizer
|
|
20
20
|
|
|
21
21
|
from .RuSH import RuSH
|
|
22
|
-
from .StaticSentencizerFun import
|
|
22
|
+
from .StaticSentencizerFun import cpredict_merge_gaps,cpredict_split_gaps, cset_annotations
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
@Language.factory("medspacy_pyrush")
|
|
26
26
|
class PyRuSHSentencizer(Sentencizer):
|
|
27
27
|
def __init__(self, nlp: Language, name: str = "medspacy_pyrush", rules_path: str = '', max_repeat: int = 50,
|
|
28
|
-
auto_fix_gaps: bool = True) -> Sentencizer:
|
|
28
|
+
auto_fix_gaps: bool = True, merge_gaps: bool = False) -> Sentencizer:
|
|
29
29
|
"""
|
|
30
30
|
|
|
31
31
|
@param rules_path: The string of the rule file path or rules themselves. By default, it will look for
|
|
@@ -33,7 +33,8 @@ class PyRuSHSentencizer(Sentencizer):
|
|
|
33
33
|
@param max_repeat: Total number of replicates that allows to be handled by "+" wildcard.
|
|
34
34
|
@param auto_fix_gaps: If gaps are caused by malcrafted rules, try to fix them.
|
|
35
35
|
However, this has no control of sentence end,
|
|
36
|
-
|
|
36
|
+
@param merge_gaps: When True, gaps between sentences are merged into the preceding sentence.
|
|
37
|
+
When False, gaps are split into separate sentences.
|
|
37
38
|
"""
|
|
38
39
|
self.nlp = nlp
|
|
39
40
|
self.name = name
|
|
@@ -43,6 +44,7 @@ class PyRuSHSentencizer(Sentencizer):
|
|
|
43
44
|
rules_path = str(os.path.join(root, 'conf', 'rush_rules.tsv'))
|
|
44
45
|
self.rules_path = rules_path
|
|
45
46
|
self.rush = RuSH(rules=rules_path, max_repeat=max_repeat, auto_fix_gaps=auto_fix_gaps)
|
|
47
|
+
self.merge_gaps = merge_gaps
|
|
46
48
|
|
|
47
49
|
@classmethod
|
|
48
50
|
def from_nlp(cls, nlp, **cfg):
|
|
@@ -57,7 +59,11 @@ class PyRuSHSentencizer(Sentencizer):
|
|
|
57
59
|
"""Apply the pipeline's model to a batch of docs, without
|
|
58
60
|
modifying them.
|
|
59
61
|
"""
|
|
60
|
-
|
|
62
|
+
if self.merge_gaps:
|
|
63
|
+
from .StaticSentencizerFun import cpredict_ww
|
|
64
|
+
guesses = cpredict_merge_gaps(docs, self.rush.segToSentenceSpans)
|
|
65
|
+
else:
|
|
66
|
+
guesses = cpredict_split_gaps(docs, self.rush.segToSentenceSpans)
|
|
61
67
|
return guesses
|
|
62
68
|
|
|
63
69
|
def set_annotations(self, docs, batch_tag_ids, tensors=None):
|