Author Topic: Can you change numerals into words  (Read 7000 times)

ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
Can you change numerals into words
« on: May 28, 2007, 03:33:56 pm »
Is it possible to change a numeral into a string variable. For example can you change '1' into the word 'one'.

Roy.
 

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Can you change numerals into words
« Reply #1 on: May 28, 2007, 04:11:35 pm »
Yes.





But when did you want to do that and why? I think Jerry already made something like this. Maybe in with Human Time or something...

It would be slightly different to make it for your sentences going in and for Hal's sentences coming out. But eitherway should be possible.


ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
Can you change numerals into words
« Reply #2 on: May 28, 2007, 04:24:29 pm »
Hi Bill,
I'm constructing a plugin to give HAL the knowledge of time, well nearly finished it, and I thought it would look better if HAL said something like 'one minute' instead of '1 minute' and so on. It's purely cosmetic but I like the look of letters rather than numbers and it would be interesting and useful to know if it could be done.

Roy.
 

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Can you change numerals into words
« Reply #3 on: May 28, 2007, 06:08:34 pm »
quote:
Originally posted by ramccoid

Hi Bill,
I'm constructing a plugin to give HAL the knowledge of time,

Of course the easy way is the hard way. Put it into a select/case statement.

Select Case TimeNumber
Case 1 : TimeString = "one"
Case 2 : TimeString = "two"
 ...
Case 60 : TimeString = "sixty"
End Select

I would put it in a function, call the function with the proper numerical value right in your concantation.

"The time is "&ChangeTime(HourVariable)&":"&"ChangeTime(MinuteVariable)

HTH


ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
Can you change numerals into words
« Reply #4 on: May 28, 2007, 06:15:31 pm »
I thought there would be an easier way. That way means if I wanted Hal to say 'one hundred and twenty minutes' I'd have to case from 1 to 120.
I might just keep it in numerals, like I said it's only cosmetic but it would have been nice to have done it in a simplier manner.
Thanks anyway Bill and I hope you are feeling better.

Roy.
 

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Can you change numerals into words
« Reply #5 on: May 28, 2007, 06:58:02 pm »
quote:
Originally posted by ramccoid

I thought there would be an easier way. That way means if I wanted Hal to say 'one hundred and twenty minutes' I'd have to case from 1 to 120.


Well, not really, if you are slick...

DigitArray(one, two, three, four, five, six, ... nineteen)
DecimalArray(twenty, thirty... ninety)
HigherArray(hundred, thousand, million, billion)

Function ParseNumber(137,325)
ReturnString = One "&"Hundred "&" and "&"thirty "&"Seven "&"Thousand "&","&"Three "&"hundred "&"and "&Twenty "&"Five "

...or something to that effect.



Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3851
    • View Profile
Can you change numerals into words
« Reply #6 on: May 28, 2007, 07:33:48 pm »
Just curious but why would you want Hal to state "one hundred twenty minutes" instead of "two hours"?
Couldn't you set 60 minutes as = "one hour"?

This way is you had last chatted with Hal say 360 minutes ago, it would know and respond with "It's been six hours since we last spoke" or something to that effect.

I'm not sure what you meant by giving Hal the knowledge of time as to how much time has elapsed since the last user chat or simply to do the cosmetic thing.

Either way good luck with the plug....
In the world of AI it's the thought that counts!

- Art -

onthecuttingedge2005

  • Guest
Can you change numerals into words
« Reply #7 on: May 28, 2007, 08:28:40 pm »
I am sorry, the more I think about Ziggy from quantum leap the more I have to think about benny hill just to cheer myself up.

by the way, Ziggy from Quantum leap was a female and had no guilt built in to its routine.

I am getting to old for this.
Jerry[8D]
« Last Edit: May 28, 2007, 08:33:23 pm by onthecuttingedge2005 »

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Can you change numerals into words
« Reply #8 on: May 28, 2007, 08:52:51 pm »
quote:
Originally posted by onthecuttingedge2005

I am sorry, the more I think about Ziggy from quantum leap

Heh... I'm afraid I never thought of Ziggy as the one from Quantum Leap... I couldn't figure out why you named your plugins after that little bald guy in the comics!

I used to watch Quantum Leap all the time. Reminded me of those "Land of the Giants" type shows from the late 60s. Same basic format as Lost in Space, Gilligan's Island and Stargate.


ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
Can you change numerals into words
« Reply #9 on: May 29, 2007, 02:29:58 am »
quote:
Just curious but why would you want Hal to state "one hundred twenty minutes" instead of "two hours"?
Couldn't you set 60 minutes as = "one hour"?


All will be revealed soon.

 
quote:
Well, not really, if you are slick...


I see more clearly now in the cold light of morning. That's definitely a slick way of doing it. Thanks Bill.

Roy.
 

onthecuttingedge2005

  • Guest
Can you change numerals into words
« Reply #10 on: May 29, 2007, 04:01:59 am »
quote:
Originally posted by Bill DeWitt

quote:
Originally posted by onthecuttingedge2005

I am sorry, the more I think about Ziggy from quantum leap

Heh... I'm afraid I never thought of Ziggy as the one from Quantum Leap... I couldn't figure out why you named your plugins after that little bald guy in the comics!

I used to watch Quantum Leap all the time. Reminded me of those "Land of the Giants" type shows from the late 60s. Same basic format as Lost in Space, Gilligan's Island and Stargate.



That's the reason I like you so much, we are on the same page!

Jerry[8D]

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Can you change numerals into words
« Reply #11 on: June 01, 2007, 07:10:03 am »
ramccoid,
  I was just looking through the brain editor and noticed the format appointment data base.  It seems you would like something like this for Hal.
Carl2
 

ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
Can you change numerals into words
« Reply #12 on: June 02, 2007, 01:50:58 am »
Hi Carl2,
Yes, that sort of thing would do the job.
Thanks for the information,

Roy.