FW: Shorten string

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

FW: Shorten string

Ron Teitelbaum
Sorry saw a typo.  Here it is again :)

'vowels' copyWithoutAll: 'aeiou' copy.

'vowels' select: [:aCharacter | aCharacter isVowel not].

aStream := 'vowels' copy readStream.
result := WriteStream on: String new.
[aStream atEnd] whileFalse: [
        nextCharacter := aStream next.
        nextCharacter isVowel
        ifFalse: [
                result nextPut: nextCharacter.
        ]
].
^result contents

Ron Teitelbaum

> From: Benoit St-Jean
> Sent: Thursday, March 01, 2007 9:58 AM
>
> Try this:
>
> 'vowels' reject: [:e | 'aeiouy' includes: e]
>
>
> -----------------
> Benoit St-Jean
> Yahoo! Messenger: bstjean
> Blog: lamneth.wordpress.com
> A standpoint is an intellectual horizon of radius zero.
> (Albert Einstein)
>
> ----- Original Message ----
> From: Mathieu Suen <[hidden email]>
> To: The general-purpose Squeak developers list <squeak-
> [hidden email]>
> Sent: Thursday, March 1, 2007 9:51:48 AM
> Subject: Shorten string
>
> Hi,
>
> Is they a way to shorten string in a way that i still understandable
> but more compacte?
> For exemple something  that remove all the vowel.
>
> Thanks
>
>     Math
>
>
>
>
>






Reply | Threaded
Open this post in threaded view
|

Re: Shorten string

Bert Freudenberg
'The general-purpose Squeak developers list' contractTo: 20

- Bert -

On Mar 1, 2007, at 16:44 , Ron Teitelbaum wrote:

> Sorry saw a typo.  Here it is again :)
>
> 'vowels' copyWithoutAll: 'aeiou' copy.
>
> 'vowels' select: [:aCharacter | aCharacter isVowel not].
>
> aStream := 'vowels' copy readStream.
> result := WriteStream on: String new.
> [aStream atEnd] whileFalse: [
> nextCharacter := aStream next.
> nextCharacter isVowel
> ifFalse: [
> result nextPut: nextCharacter.
> ]
> ].
> ^result contents
>
> Ron Teitelbaum
>
>> From: Benoit St-Jean
>> Sent: Thursday, March 01, 2007 9:58 AM
>>
>> Try this:
>>
>> 'vowels' reject: [:e | 'aeiouy' includes: e]
>>
>>
>> -----------------
>> Benoit St-Jean
>> Yahoo! Messenger: bstjean
>> Blog: lamneth.wordpress.com
>> A standpoint is an intellectual horizon of radius zero.
>> (Albert Einstein)
>>
>> ----- Original Message ----
>> From: Mathieu Suen <[hidden email]>
>> To: The general-purpose Squeak developers list <squeak-
>> [hidden email]>
>> Sent: Thursday, March 1, 2007 9:51:48 AM
>> Subject: Shorten string
>>
>> Hi,
>>
>> Is they a way to shorten string in a way that i still understandable
>> but more compacte?
>> For exemple something  that remove all the vowel.





Reply | Threaded
Open this post in threaded view
|

Re: Shorten string

Mathieu SUEN
Thanks that  one is quite cool.

        Math

On Mar 1, 2007, at 5:23 PM, Bert Freudenberg wrote:

> 'The general-purpose Squeak developers list' contractTo: 20
>
> - Bert -
>
> On Mar 1, 2007, at 16:44 , Ron Teitelbaum wrote:
>
>> Sorry saw a typo.  Here it is again :)
>>
>> 'vowels' copyWithoutAll: 'aeiou' copy.
>>
>> 'vowels' select: [:aCharacter | aCharacter isVowel not].
>>
>> aStream := 'vowels' copy readStream.
>> result := WriteStream on: String new.
>> [aStream atEnd] whileFalse: [
>> nextCharacter := aStream next.
>> nextCharacter isVowel
>> ifFalse: [
>> result nextPut: nextCharacter.
>> ]
>> ].
>> ^result contents
>>
>> Ron Teitelbaum
>>
>>> From: Benoit St-Jean
>>> Sent: Thursday, March 01, 2007 9:58 AM
>>>
>>> Try this:
>>>
>>> 'vowels' reject: [:e | 'aeiouy' includes: e]
>>>
>>>
>>> -----------------
>>> Benoit St-Jean
>>> Yahoo! Messenger: bstjean
>>> Blog: lamneth.wordpress.com
>>> A standpoint is an intellectual horizon of radius zero.
>>> (Albert Einstein)
>>>
>>> ----- Original Message ----
>>> From: Mathieu Suen <[hidden email]>
>>> To: The general-purpose Squeak developers list <squeak-
>>> [hidden email]>
>>> Sent: Thursday, March 1, 2007 9:51:48 AM
>>> Subject: Shorten string
>>>
>>> Hi,
>>>
>>> Is they a way to shorten string in a way that i still understandable
>>> but more compacte?
>>> For exemple something  that remove all the vowel.
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

RE: Shorten string

Ron Teitelbaum
Heheheh!  Ok so Bert wins he read the question much better then I did.

How about:

^((aString substrings reject: [:aWord | aWord size < 4]) collect: [:aWord |
        StandardAbbriviations at: aWord ifAbsent: [aWord]
]) mergeDelimited: $ .

Ron Teitelbaum

> -----Original Message-----
> From: Mathieu Suen
> Sent: Thursday, March 01, 2007 12:02 PM
>
> Thanks that  one is quite cool.
>
> Math
>
> On Mar 1, 2007, at 5:23 PM, Bert Freudenberg wrote:
>
> > 'The general-purpose Squeak developers list' contractTo: 20
> >
> > - Bert -
> >
> > On Mar 1, 2007, at 16:44 , Ron Teitelbaum wrote:
> >
> >> Sorry saw a typo.  Here it is again :)
> >>
> >> 'vowels' copyWithoutAll: 'aeiou' copy.
> >>
> >> 'vowels' select: [:aCharacter | aCharacter isVowel not].
> >>
> >> aStream := 'vowels' copy readStream.
> >> result := WriteStream on: String new.
> >> [aStream atEnd] whileFalse: [
> >> nextCharacter := aStream next.
> >> nextCharacter isVowel
> >> ifFalse: [
> >> result nextPut: nextCharacter.
> >> ]
> >> ].
> >> ^result contents
> >>
> >> Ron Teitelbaum
> >>
> >>> From: Benoit St-Jean
> >>> Sent: Thursday, March 01, 2007 9:58 AM
> >>>
> >>> Try this:
> >>>
> >>> 'vowels' reject: [:e | 'aeiouy' includes: e]
> >>>
> >>>
> >>> -----------------
> >>> Benoit St-Jean
> >>> Yahoo! Messenger: bstjean
> >>> Blog: lamneth.wordpress.com
> >>> A standpoint is an intellectual horizon of radius zero.
> >>> (Albert Einstein)
> >>>
> >>> ----- Original Message ----
> >>> From: Mathieu Suen <[hidden email]>
> >>> To: The general-purpose Squeak developers list <squeak-
> >>> [hidden email]>
> >>> Sent: Thursday, March 1, 2007 9:51:48 AM
> >>> Subject: Shorten string
> >>>
> >>> Hi,
> >>>
> >>> Is they a way to shorten string in a way that i still understandable
> >>> but more compacte?
> >>> For exemple something  that remove all the vowel.
> >
> >
> >
> >
> >
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Shorten string

Mathieu SUEN
In reply to this post by Bert Freudenberg
We can think about somethings like this:
The general-purpose Squeak developers list' contractTo: 15

-> 'Squeak dev list'

Hope one day that could existe.

But what about somethings that search for well known short word list  
like:

collection -> col
development -> dev
Squeak -> Sq
hour -> Hr

before doing contract.
And also remove the: 'the' 'a' 'at' 'for' ...

        Math


On Mar 1, 2007, at 5:23 PM, Bert Freudenberg wrote:

> 'The general-purpose Squeak developers list' contractTo: 20
>
> - Bert -
>
> On Mar 1, 2007, at 16:44 , Ron Teitelbaum wrote:


Reply | Threaded
Open this post in threaded view
|

Re: Shorten string

stephane ducasse
But mathieu for shortening method cat this is not really adpated :)

On 1 mars 07, at 18:55, Mathieu Suen wrote:

> We can think about somethings like this:
> The general-purpose Squeak developers list' contractTo: 15
>
> -> 'Squeak dev list'
>
> Hope one day that could existe.
>
> But what about somethings that search for well known short word  
> list like:
>
> collection -> col
> development -> dev
> Squeak -> Sq
> hour -> Hr
>
> before doing contract.
> And also remove the: 'the' 'a' 'at' 'for' ...
>
> Math
>
>
> On Mar 1, 2007, at 5:23 PM, Bert Freudenberg wrote:
>
>> 'The general-purpose Squeak developers list' contractTo: 20
>>
>> - Bert -
>>
>> On Mar 1, 2007, at 16:44 , Ron Teitelbaum wrote:
>
>
>