Making the Perfect Grammar Script

Let's face it, people on the Internet show poor grammar. I suppose it is often a sign of laziness. Back in the java applet days, I often made grammatical errors of not adding periods to end of sentences, capitalizing the first letter of the first word of sentences, and making typos. Well, I wrote a script that takes care of the first 2, but not for typos, of course. This is followed by miscellaneous others.

First, we shall know that your text is not on text event. On text event for remotes is for other people's text. Your text (or input) is on input event. And $1- is your text. What is $1-? It is $1 going onwards to infinity.

$1 $2-3 $4 $5- etc...

Therefore, $2- is every word of your sentence string except the first one..

Now, before we move on to remotes, we will start with aliases.

/sayhi {
  /say Hi.

So when you type '/sayhi' your mIRC will make you /say Hi.

/mysentence {
  /say Word 1: $1 Word 2: $2

So if you type /mysentence Hi test, your mIRC will make you say...

Word 1: Hi Word 2: test

So yes, as a review, $1- is your entire input string.

//say $calc(2 + 2)

Will return 4.

Now, we can make an /add alias.

/add {
  /say $1 + $2 = $calc($1 + $2)

So typing /add 3 5 will make you /say...

3 + 5 = 2

If statements.

/test {
  if ($1 == 1) /say My first word I typed is 1. | else /say My first word is not 1!

So by typing /test 1 you will say: My first word is 1. Of course, if you typed anything else, you will say: My first word is not 1!

/test2 {
  if (2 < 5) {
    /say 2 is less than 5!
  else { /say 2 is greater than 5!

Therefore, by typing /test2, it doesn't matter what you type anything after that, you will always /say 2 is less than 5!

The script.

I have included a snippet for an input event. It's purpose is to correct an input made from short-cuts. I have worked on this for years and it has slowly evolved, so I'm releasing it for the sake of good grammar.

I don't want to hear this "I'm too lazy to type in good grammar" or "English is my second language so I can't spell 'you' or 'your'" crap, and your disability for this would not be English as a second language, but your disabilities to spell. What this means is the way you word may seem weird, not the way you spell.

From this tutorial I hope some of you may actually get something out of it but okay.

The shortcuts.

First thing most commonly taken as a shortcut, the word 'chan.' This script makes the word 'chan' become 'channel,' both upper and lower case.

What you would not want to use, is.

$1- = $replacecs($1-,chan, channel, Chan, Channel).

You get one point for making it case-sensitive, but what this actually does is make *chan* *chan*nel. Hence, channel, will become channelnel, and chandelier, will become channeldelier.

$1- = $replacecs($1-,channel, channel, Channel, Channel).

$1- = $replacecs($1-,chan, channel, Chan, Channel).

This solves the 'channel' problem, but not changed, and, etc.

One note about the chan is that it will not become channel if the word 'Jackie' is right before it. So, while 'chan' may become 'channel,' 'Jackie Chan,' will still be 'Jackie Chan,' and not 'Jackie Channel.' You can go ahead and make your own word list for words before the word 'chan,' or simply take it out of your consideration if your IRC life involves a lot of last names of Chan.

Several other things this script takes into conversation:

'ur' becomes 'your,' and "u're" becomes "you're," both upper and lower case. 'i,' 'r,' and 'u,' becomes 'I,' 'are,' and 'you.'

Several examples of commonly used typos people make I have included, such as 'rite,' 'thru,' and 'email.'

Other commonly made shortcuts are 'ppl,' 'dunno,' 'convo,' and 'gotta.' 'Goin' becomes 'going' and 'cam' becomes 'camera' as well as 'reg' becomes 'regular.'

However, 'reg user' becomes 'regular user,' not 'register user.'

This script also edits /cs, /ns, and /ms.

"type /cs op #channel nick," will return "Type /chanserv op #channel nick."

This I find to be a general convenience. You can also use /Cs, /Ns, and /Ms to return ChanServ, NickServ, and MemoServ (rather than chanserv, nickserv, and memoserv).


We all hope to know that $1- is your entire input event. And, this to capitalize letters, comes the identifier.

$upper() Returns text in uppercase.

$upper(hello) returns HELLO.

Oppositely, the $lower() identifier does the opposite.

But, we only want to capitalize the first letter of the first word of the sentence.

I bring you to two identifiers, $left() and $right().

$left(goodbye,4) returns good.

If the number is a negative value, it returns all but the number characters.

$mid() works slightly different.

So, to capitalize the first letter of the first word of the sentence, we use $upper($left($1-,1)).

Note that for every ( there is a ).

Some examples of this script:

"ok msg me pls"

Will return:

"Okay message me please."

Note: /msg will not return /message.

Note: msg is not to be confused with the salt MSG, which will not be replaced.

And, how did we end up with a period at the end of the sentence?

I bring you to $+.

/say 1 2 $+ 3 4, will return 1 23 4.

But, $upper($left($1-,1)) $+ . will return the first capitalized letter and the period, which is not what we want.

What we want is starting from the second later of the first word of the sentence to the last letter of the last word of the sentence.

But what did we just learn, the $right() identifier.


Returns the N right characters of text.

$right(othello,5) returns hello.

If N is a negative value, it returns all but N characters.

And so, $+($upper($left($1-,1)),$right($1-,-1)) $+ . returns your entire $1- sentence (called a string) by capitalizing the first letter of the first word of the sentence and adding a period at the end of the last word of the sentence. However, this script will not add a period at the end of the sentence if you already typed a period there, or if the sentence ends in a question mark or exclamation mark.

"help me ppl i r stupid"

Will return. "Help me people I am stupid."

"do not pm me nick I do not like to receive pms" Will return.

"Do not private message me nick I do not like to receive private messages."

Note: The square root of negative one is i. So, it should not be capitalized. This script takes that into consideration.

'u and i' Returns, "You and I."

"the square root of negative 1 is i"

This will not capitalize i.

Returns, "The square root of negative 1 is i."

What this does is base the words in the sentence to detect whether or not i should or should not be capitalized.

What we don't want to do is put a period at the end of the sentence if the first letter of the last word begins with a #. In other words, we do not want to put a period after a #channel name.

#Help is not the same as #Help.

What we need is to return the first letter of the last word of the sentence.

That would be $left($gettok($1-,-1,32),1).

It could also be, $($ $+ $0,2).

And so.

"pls join #help.desk"

Will not add a period at the end of the sentence. It will return, "Please join #help.desk"

"stop pming me nick talk to me in the open channel #spiderslair"


"Stop private messaging me nick talk to me in the open channel #spiderslair"

If you didn't already know, clicking the channel name with a period after it actually changes the channel name, so it is your job to reword your sentence having that channel name in the middle of the sentence. However, we do not want to strip periods in channel names because #Help.Desk will become #HelpDesk and those happen to be two different channels.

Apparently, having a period at the end of the sentence will throw away the purpose of smileys and emoticons.

So, why not say expressions without having to have a period at the end of the sentence?


Well, they all have something in common. We use this to detect the second last letter of the $1- string. They were either a colon, a semicolon, or a hyphen, etc.

So, we want to detect if the second last letter of the sentence is not a colon, semicolon, etc.

And what might the second letter of the last word of the string be?


Therefore, you will not have a period at the end of a smiley if the second last letter of the sentence matches what you put it not to do.

However, this brings a problem with quotations.

"This is a sentence"

Will return.

"this is a sentence".

Note that that is improper grammar, the period is supposed to be before the quotation.

At the same time, "sentence test." becomes "sentence test.".

Not that there is a period before and after. So it would be nice to just have the period after it eh?

This script makes "this is a sentence" to "This is a sentence."

And did you notice, it capitalized the second character of the string? How did we come around to it?

The " is $chr(34), and knowing how to detect it if it were the last character of our string:

this is a sentence"

Now, we know how to add a period after the ", but what about before the "?

Take a look at this code. $+($left($1-,1),$mid($1-,2,-1)) $+ . $+ $right($1-,1))))

this is a sentence" becomes this is a sentence."

So although a period is added before the quotations, the first letter, or second charcter, is not capitalized.

So how do we go about fixing that? A code like this will capitalize the letter.

$+($upper($left($1-,1)),$mid($1-,2,-1) $+ . $+ $right($1-,1))))

this is a sentence" will return This is a sentence."

But notice there is no quotations to begin with.

$+($chr(34),$upper($left($1-,1)),$mid($1-,2,-1)) $+ . $+ $right($1-,1))))

this is a sentence" becomes "This is a sentence."

Of course, though, if you did happen to type "This is a sentence," you would get double the " that you don't need. Hence, an if statement to check our very first character of the string is necessary. And aside from that, there will be other problems.

"this is a sentence?" will not return "this is a sentence?."

That's another no no.

"test = "Test."

And test" = "Test."

"test? And test?" = "Test?"

"test."! = "Test!" and "test!"? = "Test!?"

Now, back in the days I would always capitalize the first letter of the first word of the sentence and add a period at the end, even right after I coded this for myself. But eventually, knowing my script was doing it for me, I got lazy. Real lazy. So now, I just type poorly and let my script do it all for me. And that led to this.

This script also takes into considerations of contractions. People tend to just not use them. And so.

cant = can't.
dont = don't.

However, just for the sake of non-laziness, if you add a contraction, the script will trigger to the non-contraction form.


doesnt = doesn't.
doesn't = does not.

That can be a problem for some people but eventually, as myself, you get used to it.

"I cant understand y u can't understand a lotta ppl r stupid"

Will return:

"I can't understand why you can not understand a lot of people are stupid."

This script also happens to deal with excess words.

hi !

Will return.


Better yet.


Will return.


And, to combine the two:

Stop !!!!

Will bring it to.


Then, this != that will still be This != that.


so , r u thru with your homework !!!!

Will return.

So, are you through with your homework!

Now, I didn't originally write this for myself, as I do not have that problem, but knowing I have wrote this script and other people may use, I though I'd add this feature so people using the script here may at least look somewhat intelligent.

Of course, the problem with all this that I had, is when I paste logs of people, everyone's grammar is automatically edited. Ain't that convenient eh? So much to the point that I would have to /remote off (I use /r off) or even /disable #input (I use /d #input) and then paste. However, *my script,* that I didn't include here, checks to see if the first letter starts with a < or [ ([ for timestamp) and not edit.

And where did I come up with all these ideas? Why, I'd look at other people's grammar. Particular I'd scroll to see the moderator Cobra^'s grammar, and find ideas that need to be fixed.

If you were to correct your grammar, by ending it with an asterisk, then your entire line will not be edited. Knowing Earth could be capitalized or not:


Will keep it as is.

Last samples:

"ok. this is a series of sentences. i made it. it is boring!!"


"Okay. This is a series of sentences. I made it. It is boring!"

"so u ur u're U Ur U're i id im ive i've cant isnt isn't chan reg pic ic cuz esp. january youre"


"So you your you are You Your You are I I'd I'm I've I have can't isn't is not channel register picture I see because especially January you're."

"im a newb!!!!! and crazy ?? and stupid!!??"


"I'm a newb! And crazy? And stupid!?"

test, test., and ,test, returns Test.

Input event code:

Not this is not the final one. More to come on a later release.

#input on
on *:input:*: {
  if ($istok(channel chat query status window, $window($active).type, 32)) {
    if (/* !iswm $1) {
      if ($inpaste) && ([*] iswm $1-6) { /echo $7- | halt }
      if (*, iswm $right($1-,1)) tokenize 32 $left($1-,-1)
      if (*, iswm $left($1-,1)) tokenize 32 $right($1-,-1)
      var %a = $regsubex($1-,/([a-zA-Z])\1++/g,\1\1)
      ;set -ln %a $1-
      var %b = $regsub(%a,/\s?(!(?!=)|\?)\1*/g,\1,%a)
      while ($regex(%a,/([?!.] [a-z])/)) %a = $replacecs(%a,$regml(1),$upper($regml(1)))
      while ($findtokcs(%a,aint,32)) %a = $puttok(%a,ain't,$ifmatch,32) | while ($findtokcs(%a,Aint,32)) %a = $puttok(%a,Ain't,$ifmatch,32)
      while ($findtokcs(%a,aren't,32)) %a = $puttok(%a,are not,$ifmatch,32) | while ($findtokcs(%a,Aren't,32)) %a = $puttok(%a,Are not,$ifmatch,32)
      while ($findtokcs(%a,arent,32)) %a = $puttok(%a,aren't,$ifmatch,32) | while ($findtokcs(%a,Arent,32)) %a = $puttok(%a,Aren't,$ifmatch,32)
      while ($findtokcs(%a,cant,32)) %a = $puttok(%a,can't,$ifmatch,32) | while ($findtokcs(%a,Cant,32)) %a = $puttok(%a,Can't,$ifmatch,32)
      if (*i r* !iswm $+($chr(32),%a,$chr(32))) { var %c = $regsub(%a,/\b(?<![#+-])r\b/g,are,%a) }
      if (*i r* iswm $+($chr(32),%a,$chr(32))) { var %c = $regsub(%a,/\b(?&;t!#)r\b/g,am,%a) }
      var %d = $regsub(%a,/(?<=^| )n(?=[ '!?;]|\.(?!\w)|$)/gi,and,%a) $regsub(%a,/(?<=^| )N(?=[ '!?;]|\.(?!\w)|$)/gi,And,%a)  $regsub(%a,/\b(?<!#)ok\b/g,okay,%a) $regsub(%a,/\b(?<!#)Ok\b/g,Okay,%a) $regsub(%a,/(?<=^| )q(?=[ '!?;]|\.(?!\w)|$)/gi,question,%a) $regsub(%a,/(?<=^| )Q(?=[ '!?;]|\.(?!\w)|$)/gi,Question,%a) $regsub(%a,/(?<=^| )u(?=[ '!?;]|\.(?!\w)|$)/gi,you,%a) $regsub(%a,/(?<=^| )U(?=[ '!?;]|\.(?!\w)|$)/gi,You,%a) $regsub(%a,/\b(?<![#+-])ur\b/g,your,%a) $resub(%a,/\b(?<!#)Ur\b/g,Your,%a) $regsub(%a,/(?<=^| )w(?=[ '!?;]|\.(?!\w)|$)/gi,what,%a) $regsub(%a,/(?<=^| )W(?=[ '!?;]|\.(?!\w)|$)/gi,What,%a) $regsub(%a,/(?<=^| )y(?=[ '!?;]|\.(?!\w)|$)/gi,why,%a) $regsub(%a,/(?<=^| )Y(?=[ '!?;]|\.(?!\w)|$)/gi,Why,%a) $regsub(%a,/\b(?<!#)wud\b/g,would,%a) $regsub(%a,/\b(?<!#)Wud\b/g,Would,%a)
      while ($findtokcs(%a,/ms,32)) %a = $puttok(%a,/memoserv,$ifmatch,32)
      while ($findtokcs(%a,msg,32)) %a = $puttok(%a,message,$ifmatch,32)
      while ($findtokcs(%a,ic,32)) %a = $puttok(%a,I see,$ifmatch,32) |  while ($findtokcs(%a,IE,32)) %a = $puttok(%a,Internet Explorer,$ifmatch,32)
      while ($findtokcs(%a,ppl,32)) %a = $puttok(%a,people,$ifmatch,32) | while ($findtokcs(%a,Ppl,32)) %a = $puttok(%a,People,$ifmatch,32)
      while ($findtokcs(%a,rite,32)) %a = $puttok(%a,right,$ifmatch,32) | while ($findtokcs(%a,Rite,32)) %a = $puttok(%a,Right,$ifmatch,32)
      while ($findtokcs(%a,pming,32)) %a = $puttok(%a,private messaging,$ifmatch,32)
      while ($findtokcs(%a,thru,32)) %a = $puttok(%a,through,$ifmatch,32) | while ($findtokcs(%a,Thru,32)) %a = $puttok(%a,Through,$ifmatch,32)
      while ($findtokcs(%a,url,32)) %a = $puttok(%a,uniform resource locator,$ifmatch,32)
      .echo -q $regsub(%a,/(?<=^| )(bro)(?= |$)/gi,\1ther,%a) $regsub(%a,/(?<=^| )(cam)(?= |$)/gi,\1era,%a) $regsub(%a,/(?<=^| )(goin)(?= |$)/gi,\1g,%a) $regsub(%a,/(?<=^| )(gov)(?= |$)/gi,\1ernment,%a) $regsub(%a,/(?<=^| )(ok)(?= |$)/gi,\1ay,%a) $regsub(%a,/(?<=^| )(pic)(?= |$)/gi,\1ture,%a) $regsub(%a,/(?<=^| )(porn)(?= |$)/gi,\1ography,%a) $regsub(%a,/(?<=^| )(sis)(?= |$)/gi,\1ter,%a) $regsub(%a,/(?<=^| )(tho)(?= |$)/gi,\1ugh,%a)
      .echo -q $regsub(%a,/\b u're \b/gx,you're, %a) $regsub(%a,/\b U're \b/gx,You're, %a) $regsub(%a,/\b u've \b/gx,you've, %a) $regsub(%a,/\b U've \b/gx,You've, %a)
      if (*Jackie Chan* !iswm $+($chr(32),%a,$chr(32))) {
        .echo -q $regsub(%a,/(?<=^| )(chan)(?=\b)/gi,\1nel,%a)
      if (*reg user* !iswm $+($chr(32),%a,$chr(32))) {
        .echo -q $regsub(%a,/(?<=^| )(reg)(?= |$)/gi,\1ister,%a)
      if (*reg user* iswm $+($chr(32),%a,$chr(32))) {
        .echo -q $regsub(%a,/(?<=^| )(reg)(?= |$)/gi,\1ular,%a)
      if ($regex(%a,$+(/\b,$hget(expansions,1),\b/))) %a = $replacecs(%a,dunno, don't know, Dunno, Don't know,gimme, give me, Gimme, Give me,gonna, going to, Gonna, Going to,gotta, got to, Gotta, Got to,kinda, kind of, Kinda, Kind of,lemme, let me, Lemme, Let me,lotta, lot of, Lotta, Lot of,musta, must have, Musta, Must have,outa, out of, Outa, Out of,sorta, sort of, Sorta, Sort of,wannabe, want to be, Wannabe, Want to be,wanna, want to, Wanna, Want to) 
      %a = $replacecs(%a,pokemon, pok�©mon, Pokemon, Pok�©mon,protege, prot�©g�©, Protege, Prot�©g�©)
      %a = $replacecs(%a,AFAIK, as far as I know,BBL, be back later,BRB, be right back,FYI, for your information,IIRC, if i remember correctly)
      %a = $replacecs(%a,convo, conversation, Convo, Conversation,del., delete, Del., Delete,pls, please, Pls, Please,prolly, probably, Prolly, Probably,regged, registered, Regged, Registered,secs, seconds, Secs, Seconds)
      %a = $replacecs(%a,d.n.a., deoxyribonucleic acid, Dna, Deoxyribonucleic acid,r.n.a., ribonucleic acid,u. s. of a., United States of America,u.s., U.S.,/cs, /chanserv, /Cs, /ChanServ,/ns, /nickserv, /Ns, /NickServ,/msg, /msg)
      %a = $replacecs(%a,email, e-mail, Email, E-mail,california, California,chicago, Chicago,illinois, Illinois,san diego, San Diego)
      %a = $replacecs(%a,couldnt, couldn't, Couldn't, Could not,couldve, could have, Could've, Could have,didnt, didn't, Didnt, Didn't,doesnt, doesn't, Doesnt, Doesn't,dont, don't, Dont, Don't,hasnt, hasn't, Hasnt, Hasn't,havent, haven't, Havent, Haven't,isnt, isn't, Isnt, Isn't,itd, it'd, Itd, It'd,itll, it'll, Itll, It'll,maam, ma'am, Maam, Ma'am,shouldnt, shouldn't, Shouldnt, Shouldn't,shouldve, should've, Shouldve, Should've,theres, there's, Theres, There's,theyre, they're, Theyre, They're,wasnt, wasn't, Wasnt, Wasn't,werent, weren't, Werent, Weren't,wont, won't, Wont, Won't, wouldnt, wouldn't, Wouldnt, Wouldn't,wouldve, would've, Wouldve, Would've,youd, you'd, Youd, You'd,youll, you'll, Youll, You'll,youre, you're, Youre, You're,youve, you've, Youve, You've)
      %a = $replacecs(%a,january, January, february, February, april, April, june, June, july, July, august, August, september, September, october, October, november, November, december, December, sunday, Sunday, monday, Monday, tuesday, Tuesday, wednesday, Wednesday, thursday, Thursday, friday, Friday, saturday, Saturday, africa, Africa, antarctica, Antarctica, asia, Asia, australia, Australia,europe, Europe, north america, North America, south america, South America, venus, Venus, jupiter, Jupiter, uranus, Uranus, neptune, Neptune, internet, Internet)
      var %e = $regsub(%a,/\bid\b/g,I'd,%a) $regsub(%a,/\bId\b/g,I'd,%a) $regsub(%a,/\bim\b/g,I'm,%a) $regsub(%a,/\bIm\b/g,I'm,%a) $regsub(%a,/\bive\b/g,I've,%a) $regsub(%a,/\bIve\b/g,I've,%a) $regsub(%a,/\bure\b/g,you're,%a) $regsub(%a,/\bUre\b/g,You're,%a) $regsub(%a,/\buve\b/g,you've,%a) $regsub(%a,/\bUve\b/g,You've,%a)
      var %f = $regsub(%a,/\G(?!.*\b(?:calculus|square|root|-1|negative)\b)(.*?)\b(?<!\+)i\b/g,\1I,%a)
      var %g = $replace(%a,$chr(44),$+($chr(44),$chr(32)))
      if (!$istok($chr(34) $chr(39) $chr(46) $chr(63) $chr(33) $chr(42) $chr(125),$right(%a,1),32)) && (!$istok($chr(58) $chr(59) $chr(42) $chr(45),$mid(%a,-2,1),32)) && (!$istok($chr(34) $chr(39),$left(%a,1),32)) {
        if (!$istok($chr(58) $chr(59) $chr(42) $chr(45),$mid(%a,-2,1),32)) {
          if (#* !iswm $($ $+ $0,2)) {
            /say $replace($+($upper($left(%a,1)),$right(%a,-1)) $+ .,$chr(44),$+($chr(44),$chr(32))) | /halt 
          if (#* iswm $($ $+ $0,2)) {
            /say $replace($+($upper($left(%a,1)),$right(%a,-1)) ,$chr(44),$+($chr(44),$chr(32))) | /halt 
        if ($right(%a,1) == $chr(42)) {
          /say %a | /halt
      if ($istok($chr(34) $chr(39),$right(%a,1),32)) {
        if ($istok($chr(34) $chr(39),$left(%a,1),32)) {
          if (!$istok($chr(46) $chr(63) $chr(33),$mid(%a,-2,1),32)) {
            /say $+($left(%a,1),$upper($mid(%a,2,1)),$mid(%a,3,-1)) $+ . $+ $right(%a,1)))) | /halt
          if ($istok($chr(46) $chr(63) $chr(33),$mid(%a,-2,1),32)) {
            /say $+($left(%a,1),$upper($mid(%a,2,1)),$mid(%a,3,-1)) $+ $right(%a,1)))) | /halt
        if (!$istok($chr(34) $chr(39),$left(%a,1),32)) {
          if (!$istok($chr(46) $chr(63) $chr(33),$mid(%a,-2,1),32)) {
            if ((2 \\ $pos(%a,",0)) || (2 \\ $pos(%a,',0))) {
              /say $+($iif($istok($chr(34),$mid(%a,-1,1),32),$chr(34),$null),$iif($istok($chr(39),$mid(%a,-1,1),32),$chr(39),$null),$upper($left(%a,1)),$mid(%a,2,1),$mid(%a,3,-1)) $+ . $+ $right(%a,1)))) | /halt
            if ((2 // $pos(%a,",0)) || (2 // $pos(%a,',0))) {
              /say $+($upper($left(%a,1)),$mid(%a,2,1),$mid(%a,3,-1)) $+ . $+ $right(%a,1)))) | /halt
          if ($istok($chr(46) $chr(63) $chr(33),$mid(%a,-2,1),32)) {
            if ((2 \\ $pos(%a,",0)) || (2 \\ $pos(%a,',0))) {
              /say $+($iif($istok($chr(34),$right(%a,1),32),$chr(34),$null),$iif($istok($chr(39),$right(%a,1),32),$chr(39),$null),$upper($left(%a,1)),$mid(%a,2,1),$mid(%a,3,-1)) $+ $right(%a,1)))) | /halt
      if ($istok($chr(34) $chr(39),$left(%a,1),32)) {
        if ($istok($chr(34) $chr(39),$right(%a,1),32)) {
          if (!$istok($chr(46) $chr(63) $chr(33),$mid(%a,-2,1),32)) {
            /say $+($left(%a,1),$upper($mid(%a,2,1)),$mid(%a,3,-1)) $+ . $+ $right(%a,1)))) | /halt
          if ($istok($chr(46) $chr(63) $chr(33),$mid(%a,-2,1),32)) {
            /say $+($left(%a,1),$upper($mid(%a,2,1)),$mid(%a,3,-1)) $+ $right(%a,1)))) | halt
        if (!$istok($chr(34) $chr(39),$right(%a,1),32)) {
          if (!$istok($chr(46) $chr(63) $chr(33),$mid(%a,-1,1),32)) {
            if ((2 \\ $pos(%a,",0)) || (2 \\ $pos(%a,',0))) {
              /say $+($left(%a,1),$upper($mid(%a,2,1)),$mid(%a,3,-1),$right(%a,1)) $+ . $+ $+($iif($istok($chr(34),$left(%a,1),32),$chr(34),$null),$iif($istok($chr(39),$left(%a,1),32),$chr(39),$null)) | /halt
          if ($istok($chr(46) $chr(63) $chr(33),$mid(%a,-1,1),32)) {
            if ((2 \\ $pos(%a,",0)) || (2 \\ $pos(%a,',0))) {
              /say $+($left(%a,1),$upper($mid(%a,2,1)),$mid(%a,3,-1),$right(%a,1)) $+ $+($iif($istok($chr(34),$left(%a,1),32),$chr(34),$null),$iif($istok($chr(39),$left(%a,1),32),$chr(39),$null)) | /halt
      if ($istok($chr(33) $chr(63),$right(%a,1),32)) && ($istok($chr(34) $chr(39),$mid(%a,-2,1),32)) {
        if ($istok($chr(34) $chr(39),$left(%a,1),32)) {
          if ($istok($chr(46),$mid(%a,-3,1),32)) {
            /say $remove($+($left(%a,1),$upper($mid(%a,2,1)),$mid(%a,3,-2)),$mid($1-,-3,1)) $+ $iif( $istok($chr(63),$right(%a,1),32),$chr(63),$null) $+ $iif( $istok($chr(33),$right(%a,1),32),$chr(33),$null) $+ $iif( $istok($chr(34),$mid(%a,-2,1),32),$chr(34),$null) $+ $iif( $istok($chr(39),$mid(%a,-2,1),32),$chr(39),$null)| /halt
          if (!$istok($chr(46),$mid(%a,-3,1),32)) {
            /say $+($left(%a,1),$upper($mid(%a,2,1)),$mid(%a,3,-2),$iif($istok($chr(63),$right(%a,1),32),$chr(63),$null),$iif($istok($chr(33),$right(%a,1),32),$chr(33),$null),$iif($istok($chr(34),$mid(%a,-2,1),32),$chr(34),$null),$iif($istok($chr(39),$mid(%a,-2,1),32),$chr(39),$null)) | /halt
        if (!$istok($chr(34) $chr(39),$left(%a,1),32)) {
          if ($istok($chr(46),$mid(%a,-3,1),32)) {
            /say $+($iif($istok($chr(34),$mid(%a,-2,1),32),$chr(34),$null),$iif($istok($chr(39),$mid(%a,-2,1),32),$chr(39),$null),$upper($left(%a,1)),$mid(%a,2,-3)) $+ $iif($istok($chr(63),$right(%a,1),32),$chr(63),$null) $+ $iif($istok($chr(33),$right(%a,1),32),$chr(33),$null) $+ $iif($istok($chr(34),$mid(%a,-2,1),32),$chr(34),$null) $+ $iif($istok($chr(39),$mid(%a,-2,1),32),$chr(39),$null)| /halt
          if (!$istok($chr(46),$mid(%a,-3,1),32)) {
            /say $+($iif($istok($chr(34),$mid(%a,-2,1),32),$chr(34),$null),$iif($istok($chr(39),$mid(%a,-2,1),32),$chr(39),$null),$upper($left(%a,1)),$mid(%a,2,-2))) $+ $iif($istok($chr(63),$right(%a,1),32),$chr(63),$null) $+ $iif($istok($chr(33),$right(%a,1),32),$chr(33),$null) $+ $iif($istok($chr(34),$mid(%a,-2,1),32),$chr(34),$null) $+ $iif($istok($chr(39),$mid(%a,-2,1),32),$chr(39),$null)| /halt
      if ($left(%a,1) islower) && ($left(%a,1) isletter) { 
        if ($right(%a,1) != $chr(42)) {
          /say $replace($+($upper($left(%a,1)),$right(%a,-1)),$chr(44),$+($chr(44),$chr(32))) | /halt 
        if ($right(%a,1) == $chr(42)) {
          /say %a | /halt
      /say $replace(%a,$chr(44),$+($chr(44),$chr(32))) | /halt
#input end

Seeming as how large the English language is, I take it it will be some more years before I get somewhere to completion. Although I am a bit satisfied with what I have now. Still a few more minor bugs and such that don't really affect grammar.