A fast implementation of RuSH (Rule-based sentence Segmenter using Hashing).
Project description
py4jrush
py4jrush is the python interface to RuSH(https://github.com/jianlins/RuSH) (Ru le-based sentence S egmenter using H ashing), which is originally developed using Java. This version is implemented through py4j, compared with the original PyRuSH.
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.
If you wish to cite RuSH in a publication, please use:
Jianlin Shi ; Danielle Mowery ; Kristina M. Doing-Harris ; John F. Hurdle.RuSH: a Rule-based Segmentation Tool Using Hashing for Extremely Accurate Sentence Segmentation of Clinical Text. AMIA Annu Symp Proc. 2016: 1587.
The full text can be found here.
Installation
When you run pip install py4jrush, the installer will automatically check for Java JDK 8. If JDK 8 is not found, it will use the install-jdk Python package to download and install JDK 8 for you. No manual Java setup is required.
pip install py4jrush
Development and Release Process
This project uses automated workflows for building, testing, and releasing. Here's how it works:
Automated Release Workflow
The project has an automated release workflow that:
- Automatically bumps version numbers using semantic versioning
- Builds and tests the package across multiple environments
- Publishes to PyPI with proper validation
- Creates GitHub releases with built artifacts
How to Release
Option 1: Manual Workflow Trigger (Recommended)
- Go to the Actions tab in GitHub
- Select Build and Publish Python Package workflow
- Click Run workflow and configure:
- Publish to PyPI:
true(to actually publish) - Create GitHub release:
true(to create a release) - Version bump type: Choose
patch,minor, ormajor
- Publish to PyPI:
Option 2: GitHub Release Creation
Create a new release in the GitHub UI, and the workflow will automatically trigger.
Version Bumping Strategy
- patch (1.0.10 → 1.0.11): Bug fixes, small changes
- minor (1.0.10 → 1.1.0): New features, backwards compatible
- major (1.0.10 → 2.0.0): Breaking changes
Workflow Features
- ✅ Automatic version detection from current VERSION file
- ✅ Smart version bumping prevents conflicts with existing releases
- ✅ Multi-environment testing (Python 3.9, 3.10, 3.11 on Ubuntu, Windows, macOS)
- ✅ PyPI validation with twine before publishing
- ✅ Automatic VERSION file updates after successful release
- ✅ GitHub release creation with built artifacts
How to use
A standalone RuSH class is available to be directly used in your code. From 1.0.4, pyRush adopt spaCy 3.x api to initiate an component.
from py4jrush import RuSH
input_str = "The patient was admitted on 03/26/08\n and was started on IV antibiotics elevation" +\
", was also counseled to minimizing the cigarette smoking. The patient had edema\n\n" +\
"\n of his bilateral lower extremities. The hospital consult was also obtained to " +\
"address edema issue question was related to his liver hepatitis C. Hospital consult" +\
" was obtained. This included an ultrasound of his abdomen, which showed just mild " +\
"cirrhosis. "
rush = RuSH('../conf/rush_rules.tsv')
sentences=rush.segToSentenceSpans(input_str)
for sentence in sentences:
print("Sentence({0}-{1}):\t>{2}<".format(sentence.begin, sentence.end, input_str[sentence.begin:sentence.end]))
Spacy Componentized py4jrush
Start from version 1.0.3, py4jrush adds Spacy compatible Sentencizer component: PyRuSHSentencizer.
from py4jrush import PyRuSHSentencizer
from spacy.lang.en import English
nlp = English()
nlp.add_pipe("medspacy_py4jrush")
doc = nlp("This is a sentence. This is another sentence.")
print('\n'.join([str(s) for s in doc.sents]))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py4jrush-1.0.10.tar.gz.
File metadata
- Download URL: py4jrush-1.0.10.tar.gz
- Upload date:
- Size: 39.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
050f149162f24c78db26ab043aad6687f7f47e11d347e455b244be7f75431a58
|
|
| MD5 |
634de3c068c6bf0845ee94bbf82c67eb
|
|
| BLAKE2b-256 |
1af6a555d43dfb1d73034e5541929c51877332c8fe0f562b9e37ebf5b185ba2a
|
Provenance
The following attestation bundles were made for py4jrush-1.0.10.tar.gz:
Publisher:
build_publish.yml on jianlins/py4jrush
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py4jrush-1.0.10.tar.gz -
Subject digest:
050f149162f24c78db26ab043aad6687f7f47e11d347e455b244be7f75431a58 - Sigstore transparency entry: 517800136
- Sigstore integration time:
-
Permalink:
jianlins/py4jrush@50f3056c0508ca9a8554e1effa3062965f9e7809 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/jianlins
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_publish.yml@50f3056c0508ca9a8554e1effa3062965f9e7809 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file py4jrush-1.0.10-py3-none-any.whl.
File metadata
- Download URL: py4jrush-1.0.10-py3-none-any.whl
- Upload date:
- Size: 39.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
548bee4fa22b248a8edab3b0fa337ae1476e22625ac49314ba8967c54b8bb11c
|
|
| MD5 |
6e73a007613fdf4cbcb2152812e686d2
|
|
| BLAKE2b-256 |
e8d2f3df1b2fc444357922037d946a05f77e0759c8e9d528475c07428961a6ab
|
Provenance
The following attestation bundles were made for py4jrush-1.0.10-py3-none-any.whl:
Publisher:
build_publish.yml on jianlins/py4jrush
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py4jrush-1.0.10-py3-none-any.whl -
Subject digest:
548bee4fa22b248a8edab3b0fa337ae1476e22625ac49314ba8967c54b8bb11c - Sigstore transparency entry: 517800167
- Sigstore integration time:
-
Permalink:
jianlins/py4jrush@50f3056c0508ca9a8554e1effa3062965f9e7809 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/jianlins
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_publish.yml@50f3056c0508ca9a8554e1effa3062965f9e7809 -
Trigger Event:
workflow_dispatch
-
Statement type: