 |
Lain Novice
Joined: 26 Oct 2001 Posts: 38
|
Posted: Tue Apr 29, 2003 11:30 pm
%proper |
I'm attempting to make a language alteration alias, it's very basic right now - only looking and replacing words found in a data record,
#VAR temp "%-1"
#VAR temp %lower( @temp)
#LOOPDB {@oldenglish} {#VAR temp %replace( @temp, %key, %val)}
#LOOPDB {@oldenglish2} {#VAR temp %replace( @temp, %key, %val)}
#IF %begins( {@temp}, "'") {
#VAR temp %remove( ', @temp)
#VAR temp {'%proper( @temp)}
} {#VAR temp %proper( @temp)
}
~say @temp
First problem (of many):
I have two data records of words to be replaced. @oldenglish is all two word arrangements, @oldenglish2 are one words. I had to create a two word list as some words would change as a single if found in another two word string.
I've added a %lower as any words that should have changed would not if containing a uppercase letters, e.g. the first word of a sentence or the first word after a full stop, question mark, ecetera. I would like to remove this and keep the words I purposely send in captials (a name, location), but also have words from the list altered - and recapitalised if they are found at the start of the sentence or after a full stop ecetera.
Good morning. Where are you heading on this fair day?
Becomes,
Good morrow. Whither art thou heading on this fair day?
'Where' changes to 'whither' even if I send it in uppercase, and is returned to uppercase if found after a full stop, ecetera.
(The #IF looks for ' if the sentence begins with it, removes it, puts the first letter in uppercase and then replaces the '.)
Can anyone help?
Lain |
|
|
 |
Charbal GURU
Joined: 15 Jun 2001 Posts: 654 Location: USA
|
Posted: Wed Apr 30, 2003 12:51 am |
I've written a language modification script before and made it preserve the case of the first letter of the original text... it's available here.
Perhaps it'll suggest some things you can use. I would recommend letting zMUD format it before actually trying to read it though :P
- Charbal |
|
|
 |
Lain Novice
Joined: 26 Oct 2001 Posts: 38
|
Posted: Wed Apr 30, 2003 9:38 pm |
I've had a look through but's it's too complicated for me to understand, would you be able to pick out the part of the script that is doing the uppercasing? Also, I noticed you didn't have %proper anywhere in there, is there a different function which will only proper case a single word instead of the whole sentence? I've realised that by using %proper, in the case of -
#IF %begins( {@temp}, "'") {
#VAR temp %remove( ', @temp)
#VAR temp {'%proper( @temp)}
} {#VAR temp %proper( @temp)
}
- if I have another uppercase letter in the text, it will lowercased because of %proper.
This,
It is a fair day. Isn't it?
Becomes,
'Tis a fair day. is it not?
Lain |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|