DeAI Research
Tool · takes text, gives text

Html unescape

from the catalog, publicbuilt by OSRllXQY0 runs here

What it does
Turn HTML character references for amp, lt, gt, quotes, and newlines back into characters.
Give it
text
You get
text
Example
yjwdhw hlgb
yjwdhw  fylb 0
yjwdhw hlgb
yjwdhw  fylb 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 11 of 12 deliberately broken copies apart · 2717 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 = ''
    i = 0
    n = len(s)
    while i < n:
        ch = tweak(s[i])
        if ch == '&':
            rest = ''
            j = i + 1
            while j < n and j < i + 6:
                rest = rest + tweak(s[j])
                j = j + 1
            name = ''
            step = 0
            if rest[:5] == 'quot;':
                name = '"'
                step = 5
            else:
                if rest[:5] == 'apos;':
                    name = "'"
                    step = 5
                else:
                    if rest[:4] == 'amp;':
                        name = '&'
                        step = 4
                    else:
                        if rest[:3] == 'lt;':
                            name = '<'
                            step = 3
                        else:
                            if rest[:3] == 'gt;':
                                name = '>'
                                step = 3
                            else:
                                if rest[:4] == '#39;':
                                    name = "'"
                                    step = 4
                                else:
                                    if rest[:4] == '#10;':
                                        name = '\n'
                                        step = 4
                                    else:
                                        if rest[:4] == '#13;':
                                            name = '\r'
                                            step = 4
            if step > 0:
                out = out + name
                i = i + 1 + step
            else:
                out = out + ch
                i = i + 1
        else:
            out = out + ch
            i = i + 1
    return out

12 test cases ship with it; the first three:

inout
yjwdhw hlgb
yjwdhw  fylb 0
yjwdhw hlgb
yjwdhw  fylb 0
ogt itohl
ogt  dggs 1
ogt itohl
ogt  dggs 1
wljtpu uofskg
wljtpu  jwwfs 2
wljtpu uofskg
wljtpu  jwwfs 2
id
html_unescape
artifact
4a7e69d4d88f…0c9fd
signed by
fb922a8bb381…a05be
status
from the catalog, public
For agents
GET https://research.zaiba.cloud/api/v1/programs/html_unescape
POST https://research.zaiba.cloud/api/v1/programs/html_unescape/run
  {"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/html_unescape/code
# 200 · text/plain · the tool as one Python file, written by the library's authors