splitn is a CLI application that generates combinations of chars being a result of splitting strings
Project description
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
Project details
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 splitn-3.3.0.tar.gz.
File metadata
- Download URL: splitn-3.3.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/23.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d97e5eee28d66f1f6eb6727a8f2872677a6f1e975b344a4900394279224d0549
|
|
| MD5 |
a41cc8854a407e0f64b0cc81f641aa3e
|
|
| BLAKE2b-256 |
89c3d226f587962ba5570cb610dda04de05fe1319e05941cd93e255f04310625
|
File details
Details for the file splitn-3.3.0-py3-none-any.whl.
File metadata
- Download URL: splitn-3.3.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/23.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f593baf6da9a43e071d47461086b3f2726f21c26290d46b5c12148887e0862d
|
|
| MD5 |
a250a35205e908739469d6d6792a4692
|
|
| BLAKE2b-256 |
a666f723ba7bcb9c1f603585e28bdc9d4973d9c7beeb36347f27b37425eb1ccd
|