Re: Weeding out words
Re: Weeding out words
- Subject: Re: Weeding out words
- From: kai <email@hidden>
- Date: Sat, 10 Feb 2007 00:37:16 +0000
On 9 Feb 2007, at 06:15, Brett Conlon wrote:
With the current script, using "box set' won't work because it
checks against individual words only so there would be no match
even if "box set" was there in the user's response.
I wonder if searching exclusively for individual words is the best
approach here, Coj; although some words may be undesirable on their
own, I imagine there might be cases where only certain combinations/
phrases need to be avoided.
Your current routine, for example, would convert "A New TV Set Top
Box Box Set" to "A New TV Top" (which may or may not be what you
want). Something like the suggestion below produces a slightly
different result.
(Note that each 'offender' starts and ends with a space - and that
the longer composite forms should appear earlier in the list.)
------------
set TitleAns to "A New TV Set Top Box Box Set"
set Offenders to {" Box Set Collection ", " Box Set ", " Boxset "} --
etc...
set tid to text item delimiters
set text item delimiters to space
set TitleAns to space & TitleAns's words & space
repeat with Offender in Offenders
repeat while Offender is in TitleAns
set text item delimiters to Offender
set TitleAns to TitleAns's text items
set text item delimiters to space
set TitleAns to TitleAns as string
end repeat
end repeat
set text item delimiters to tid
set TitleAns to TitleAns's text 2 thru -2
--> "A New TV Set Top Box"
------------
---
kai
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden