 |
ArbiterOne Newbie
Joined: 25 Nov 2004 Posts: 4
|
Posted: Tue Nov 01, 2005 1:39 pm
Alias for capitalization and punctuation in says/tells/etc? |
Is there a way to automatically capitalize sentences, and add punctuation if there isn't already (defaulting to a period)?
i.e.
say testing
You say, 'Testing.'
say testing!
You say, 'Testing!'
say Testing
You say, 'Testing.'
I've searched the forums and haven't found anything illuminating. |
|
|
|
 |
Vitae Enchanter

Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Tue Nov 01, 2005 2:02 pm |
for the caps use the %proper() format.
But of course you'll have to do either as an oninput or an alias
#alias say {~say %proper(%1)}
typed: say test
result: You say 'Test'
so that works.
as for the punctuation, that's more like using %replace, but not sure how that would be done. |
|
|
|
 |
OmegaDeus Apprentice

Joined: 14 Sep 2005 Posts: 121
|
Posted: Tue Nov 01, 2005 6:47 pm |
well if aliasing, this could very easily be done as such
pattern: say
value #send {say %proper(%1).}
Tested and it works. |
|
_________________
Look at me I've got zSKILLS |
|
|
 |
ArbiterOne Newbie
Joined: 25 Nov 2004 Posts: 4
|
Posted: Tue Nov 01, 2005 7:16 pm |
The point is, I would want to add punctuation only if there wasn't punctuation there already. What you propose would result in:
say what the heck?
You say, "What the heck?."
Also, for some reason using %proper removes commas. Is there a way to avoid this? |
|
|
|
 |
Kiasyn Apprentice

Joined: 05 Dec 2004 Posts: 196 Location: New Zealand
|
Posted: Tue Nov 01, 2005 9:01 pm |
#send {say %proper("%-1")%if(!%ismember(%rightback(%proper("%-1"),1),"?|.|!"))}
|
|
|
|
 |
Vorax Apprentice

Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Tue Nov 01, 2005 9:51 pm |
Or try this:
| Code: |
| #ALIAS say {~say %proper( %1) %-2%if( !%match( %rightback( %-1, 1), "%p"), ., %null)} |
|
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Tue Nov 01, 2005 10:01 pm |
If you only want to do it with 'say' this would work:
#ONINPUT {^say (*)$} {#IF (%match(%rightback("%1",1),"[.!?]")=0) {say %proper("%1").} {say %proper("%1")}}
If you want to cover more channels then this will do better:
#ONINPUT {^((?:say|tell \w+|ask)) (.*)$} {#IF (%match(%rightback("%2",1),"[.!?]")=0) {#SUB {%1 %proper("%2").}} {#SUB {%1 %proper("%2")}}} "" {regex} |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
ArbiterOne Newbie
Joined: 25 Nov 2004 Posts: 4
|
Posted: Wed Nov 02, 2005 5:25 pm |
I ended up going with this, as %proper would lowercase the rest of my sentence- not what I wanted.
#ONINPUT {^((?:say*|te*l* \w+|ask|')) *(.)(.*)$} {#IF (%match( %rightback( "%3", 1), "[.!?]")=0) {#SUB {%1 %proper("%2")%3.}} {#SUB {%1 %proper("%2")%3}}} "" {regex}
(and for anyone searching: punctuation capitalization autopunctuate autopunctuation)
Thanks, everyone! |
|
|
|
 |
OmegaDeus Apprentice

Joined: 14 Sep 2005 Posts: 121
|
Posted: Wed Nov 02, 2005 8:34 pm |
well, that's the point of proper casing a sentence. Only the first word and proper nouns are supposed to be capitolized.
|
|
_________________
Look at me I've got zSKILLS |
|
|
 |
|
|
|