• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Weeding out words
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: Weeding out words (From: Brett Conlon <email@hidden>)

  • Prev by Date: Re: Getting started with XML?
  • Next by Date: Out of the office for leave
  • Previous by thread: Re: Weeding out words
  • Next by thread: Re: Weeding out words
  • Index(es):
    • Date
    • Thread