Skip to content

splitn is a CLI application that generates combinations of chars being a result of splitting strings

License

Notifications You must be signed in to change notification settings

warzocha/splitn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

splitn is a CLI application that generates combinations of chars being a result of splitting strings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages