Shoutbox

Help with a text output script - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Help with a text output script (/showthread.php?tid=75701)

Help with a text output script by Stapleman on 06-27-2007 at 08:26 PM

Hello! After having recently seen A Clockwork Orange I decided to try a script that outputs English in Nadsat.

However, I'm having some trouble.

For example, typing out "brain" gives "mozg." But when typing out "brains" I should get "mozggies," however, it only outputs "mozgs."

I think this is because the code recognizes "brain" before "brains."

My question is, is there a way to bypass this?


RE: Help with a text output script by AngelDevil on 06-27-2007 at 08:30 PM

Use "brain " (with the space at the end), and the code doesn't recognize "brains" as "brain" + "s"...


RE: Help with a text output script by Stapleman on 06-27-2007 at 08:39 PM

Many thanks!


RE: Help with a text output script by matty on 06-27-2007 at 08:56 PM

Or look for the plural of the word first. 8-)


RE: Help with a text output script by Ezra on 06-27-2007 at 09:04 PM

Or if you are using regular expressions use word boundaries.


RE: Help with a text output script by Volv on 06-28-2007 at 03:49 AM

quote:
Originally posted by AngelDevil
Use "brain " (with the space at the end), and the code doesn't recognize "brains" as "brain" + "s"...
That's not exactly the wisest thing to do, there are many times when you're going to have the word at the end of a sentence (with a period following) or at the end of the message (with nothing following) and it won't be picked up through this method.

A better alternative is to split the message up into words using .split(" ") and then stripping trailing and preceding punctuation and translating the resultant word (or leaving it the same if there's no translation).
RE: Help with a text output script by Matti on 06-28-2007 at 07:59 AM

quote:
Originally posted by Matty
Or look for the plural of the word first. 8-)
And that's the smartest and easiest thing to do! Guaranteed success! ;)
RE: Help with a text output script by markee on 06-28-2007 at 09:43 AM

quote:
Originally posted by Mattike
quote:
Originally posted by Matty
Or look for the plural of the word first. 8-)
And that's the smartest and easiest thing to do! Guaranteed success! ;)

Incorrect, "Guaranteed success!" comes from Ezra's method.

quote:
Originally posted by Ezra
Or if you are using regular expressions use word boundaries.

That way if you use any other prefix or suffix or use it within another word (like "hi" is in "this" for example) then it will not replace it.  This is "Guaranteed success!" ;)