Skip to main content

splitn is a CLI application that generates combinations of chars being a result of splitting strings provided explicite or randomly generated from regex patterns. It is made mainly for testing NLU applications, e.g. chatbots or tools for extracting structural data from text like duckling.

Installation

pipx install splitn

or

pip install splitn

Examples

Basic usage

$ splitn 486
486
48 6
4 86
4 8 6

Using with regular expressions

$ splitn "\d{3"
427
4 27
42 7
4 2 7

Using with file

Let's assume that file example.txt contains following lines.

abc
\d{2}
$ splitn example.txt
abc
a bc
ab c
a b c
---
04
0 4

Options

--separator

$ splitn abc -s -
abc
a-bc
ab-c
a-b-c

--times

$ splitn "\d{2}" -t 2
59
5 9

35
3 5

--secondary-separator

$ splitn abc def --secondary-separator +++
abc
a bc
ab c
a b c
+++
def
d ef
de f
d e f

--as-string

$ splitn "\d{2}" --as-string
\d{2}
\ d{2}
\d {2}
\d{ 2}
\d{2 }
\ d {2}
\ d{ 2}
\ d{2 }
\d { 2}
\d {2 }
\d{ 2 }
\ d { 2}
\ d {2 }
\ d{ 2 }
\d { 2 }
\ d { 2 }

--pattern

This option can be used with or without positional arguments. When used without, it makes splitn generate random sequences based on given regular expressions. When used with operands, it narrows down generated sequences to those matching provided regular expressions.

$ splitn -p "\d \d .{2}"
8 1 Ua
$ splitn "\d{4}" -p "\d \d .*"
5 9 20
5 9 2 0

Metadata

Release files for splitn 3.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for splitn 3.3.0
File Size Uploaded
splitn-3.3.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for splitn 3.3.0
File Interpreter ABI Platform
splitn-3.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / splitn-3.3.0.tar.gz

Download URL splitn-3.3.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d97e5eee28d66f1f6eb6727a8f2872677a6f1e975b344a4900394279224d0549
BLAKE2b-256 checksum
How to use checksums
89c3d226f587962ba5570cb610dda04de05fe1319e05941cd93e255f04310625
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.4 Darwin/23.0.0

Release files / splitn-3.3.0-py3-none-any.whl

Download URL splitn-3.3.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f593baf6da9a43e071d47461086b3f2726f21c26290d46b5c12148887e0862d
BLAKE2b-256 checksum
How to use checksums
a666f723ba7bcb9c1f603585e28bdc9d4973d9c7beeb36347f27b37425eb1ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.4 Darwin/23.0.0

Release history Release notifications | RSS feed

This release

3.3.0 This release

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page