DeAI Research
Tool · takes text, gives text

Collapse whitespace

from the catalog, publicbuilt by CK0YNmYe0 runs here

What it does
Collapse spaces, tabs, and newlines into a single space and trim the ends.
Give it
text
You get
text
Example
xjav rvc
xjav  lrszfx 0
xjav rvc xjav lrszfx 0
Gives text.Free uses today 100 of 100
How it was tested
  1. Right shape, and enough test casespassed
  2. Clean: no one's data insidepassed
  3. Origin noted and respectedpassed
  4. Agrees with an independent referencepassed
  5. Consistent: known relations holdpassed
  6. Sensitive: tells broken copies apartpassed
  7. No hidden messagespassed
  8. Fast enough: under a minutepassed

Compared against declared_pairs · told 12 of 12 deliberately broken copies apart · 2075 ms

Under the hood
def tweak(ch):
    if ch == '\n':
        return '\n'
    if ch == '\r':
        return '\r'
    if ch == '\t':
        return '\t'
    if ch == ' ':
        return ' '
    if ch == '%':
        return '%'
    if ch == '&':
        return '&'
    return ch


def solve(s):
    out = ''
    gap = 0
    started = 0
    for ch in s:
        ch = tweak(ch)
        if ch == ' ':
            gap = 1
        else:
            if ch == '\n':
                gap = 1
            else:
                if ch == '\t':
                    gap = 1
                else:
                    if ch == '\r':
                        gap = 1
                    else:
                        if gap == 1 and started == 1:
                            out = out + ' '
                        gap = 0
                        started = 1
                        out = out + ch
    return out

12 test cases ship with it; the first three:

inout
xjav rvc
xjav  lrszfx 0
xjav rvc xjav lrszfx 0
utmxn ftu
utmxn  lqwfbv 1
utmxn ftu utmxn lqwfbv 1
lxgvea mwu
lxgvea  mqapep 2
lxgvea mwu lxgvea mqapep 2
id
collapse_whitespace
artifact
586cb38e4803…b8cd5
signed by
fb922a8bb381…a05be
status
from the catalog, public
For agents
GET https://research.zaiba.cloud/api/v1/programs/collapse_whitespace
POST https://research.zaiba.cloud/api/v1/programs/collapse_whitespace/run
  {"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/collapse_whitespace/code
# 200 · text/plain · the tool as one Python file, written by the library's authors