pike.git / lib / modules / String.pmod

version» Context lines:

pike.git/lib/modules/String.pmod:244:   // ----------------------------------------------------------------      static private class _Elite   {   // neccesary translation (in order)    array(array(string|array(string))) elite_short=    ({    ({" you are"," your"}),    ({" you'r"," your"}),    ({" what the"," wt"}), -  ({" wt fuck"," wtf"}), -  ({" wtf?"," wtf!"}), +  ({" wt fuck"," wt\1001"}), +  ({" wt\1001?"," wt\1001!"}),    ({" download"," d/l"}),    ({" upload"," u/l"}),    ({"picture","pic"}),    ({" pornography"," pr0n"}),    ({" porn"," pr0n"}),    ({"cool","kewl"}),    ({" elite "," 1337 "}), -  +  ({"qu","kw"}), +  +  ({"japanese",".jp"}), +  ({"japan",".jp"}), +  ({"swedish",".se"}), +  ({"sweden",".se"}), +  ({"chinese",".cn"}), +  ({"china",".cn"}), +  ({"france",".fr"}),    });      // optional recursive translation (in order)    array(array(string|array(string))) elite_trans=    ({    ({"you",({"u","j00"})}),    ({" are "," r "}),    ({" ok "," k "}), -  +  ({" any "," ne "}),    ({"dude","dood"}),    ({"newbie","noob"}), -  +  ({"fuck","\1001-"}), +  ({"girl","gurl"}), +  ({"choose","pick"}),       ({"one","1"}),    ({"two","2"}),    ({"ate","8"}),    ({"twi","2"}), -  +  ({" to"," 2"}),    ({"ight","8t"}),    ({"ite","eet"}),    ({"four","4"}),    ({"fore","4"}),    ({"for","4"}),    -  ({"ff","ph"}), -  ({"f","ph"}), +  ({"ea","ee"}), +  ({"nn","n"}), +  ({"ff","\1002h"}), +  ({"f","\1002h"}), +  ({"cks",({"xor"})}),    ({"cks",({"x","xx","xz"})}),    ({"cs ",({"kz ","cz "})}),    ({"ks",({"x","xz"})}),    ({"cs",({"x","xz"})}), -  +  ({"ck ",({"xer "})}),    ({"ck",({"k","cc"})}),    ({"ers ",({"ors "})}),    ({"er ",({"or "})}),    ({"ed ",({"edz "})}), -  +  ({"me ",({"mez "})}),    ({" el",({" l"})}),    ({"s ",({"z "})}), -  ({"s!",({"z."})}), -  ({"s.",({"z!"})}), +  ({"s!",({"z!"})}), +  ({"s.",({"z."})}),    ({"s,",({"z,"})}), -  ({"!","!!"}), -  ({".","!"}), -  ({"?","??"}), +  ({"s",({"z"})}), +  ({". ","! "}), +  ({"! ","!! "}), +  ({"? ",({"?? ","!? "})}),    });      // optional one-time character translation    mapping(string:array(string)) elite_char=    ([    "a":({"4"}),    "b":({"8"}),    "c":({"("}),    "d":({"|)"}),    "e":({"3"}),    "f":({}),    "g":({"6"}), -  "h":({}), +  "h":({"|-|"}),    "i":({"1","|"}),    "j":({}),    "k":({"|<"}),    "l":({"1","|_"}),    "m":({"|V|","|\\/|"}),    "n":({"|\\|"}),    "o":({"0","()"}), -  "p":({}), +  "p":({"I=","p"}),    "q":({}),    "r":({}),    "s":({"5"}),    "t":({"+","7"}), -  "u":({}), +  "u":({"|_|"}),    "v":({"\\/"}), -  "w":({}), +  "w":({"\\/\\/"}),    "x":({"><"}),    "y":({}), -  "z":({"z","Z"}), +  "z":({}),       "0":({"()"}),    "1":({"|","l"}),    "2":({}),    "3":({"E"}),    "4":({}),    "5":({"S"}),    "6":({"G"}),    "7":({}),    "8":({}),
pike.git/lib/modules/String.pmod:349:   // translates one word to 1337. The optional   // argument leetp is the maximum percentage of   // leetness (100=max leet, 0=no leet).   // elite_word only do character-based translation,   // for instance from "k" to "|<", but no language   // translation (no "cool" to "kewl").       string elite_word(string in,void|int leetp)    {    if (zero_type(leetp)) leetp=50; // aim for 50% leetness -  else if (!leetp) return in; +  else if (!leetp) +  return replace(in,"\1001\1002\1003"/1,"fpl"/1);       array v=rows(elite_char,lower_case(in)/1);       multiset leet=(<>);    multiset unleet=(<>);    foreach (v;int i;array(string) d)    if (!d || !sizeof(d)) unleet[i]=1;    else leet[i]=1;      // lower leet level to target leetness
pike.git/lib/modules/String.pmod:373:    leet[z]=0;    unleet[z]=1;    }       string res="";    foreach (v;int i;array(string) d)    if (leet[i])    {    res+=d[random(sizeof(d))];    } -  else if (leetp>50) // add random caps -  res+=(random(2)?upper_case:lower_case)(in[i..i]); +     else -  res+=in[i..i]; +  { +  string s=in[i..i]; +  if ( (<"\1001","\1002">)[s] ) +  s=replace(s,"\1001\1002\1003"/1,"fpl"/1);    -  +  +  if (leetp>50) // add random caps +  res+=(i&1?upper_case:lower_case)(s); +  else +  res+=s; +  } +     return res;    }      // translates a string to 1337. The optional   // argument leetp is the maximum percentage of   // leetness (100=max leet, 0=no leet).   //   // The translation is performed in three steps,   // first the neccesary elite translations (picture -> pic,   // cool->kewl etc), then optional translations