Warning: session_start(): open(/var/lib/php/sessions/sess_k34l2r4hdlvdefeafvp5p0iejm, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static L switcheroo_themap = ll(
"mine", "yours",
"my", "your",
"you are", "i am",
"are you", "am i",
"you're", "i'm",
"you've", "i've",
"me", "you",
"i", "you",
);
static S switcheroo(S s) {
L tok = nlTok5(s);
for (int i = 1; i < l(tok); i += 2) {
for (int j = 0; j < l(switcheroo_themap); j += 2) {
S x = switcheroo_themap.get(j), y = switcheroo_themap.get(j+1);
L tokx = nlTok5(x), toky = nlTok5(y);
switcheroo_matchReplace(tok, i, tokx, toky);
switcheroo_matchReplace(tok, i, toky, tokx);
}
}
ret join(map(f switcheroo_dropAsterisk, tok));
}
sS switcheroo_dropAsterisk(S t) {
ret startsWith(t, "*") && l(t) > 1 ? substring(t, 1) : t;
}
static void switcheroo_matchReplace(L tok, int i, L tokx, L toky) {
//printFormat("Matching * * *", i, get(tok, i), tokx);
if (switcheroo_tokRegionMatch(tok, i, tokx)) {
//printFormat("Replacing * *", tokx, toky);
for (int j = 0; j*2+1 < l(tokx); j++)
tok.set(i+j*2, "*" + toky.get(1+j*2));
}
}
static bool switcheroo_tokRegionMatch(L tok, int i, L tokx) {
for (int j = 0; j*2+1 < l(tokx); j++)
if (!eqic(get(tok, i+j*2), get(tokx, 1+j*2)))
ret false;
ret true;
}