Quickie Text Manipulation Script
December 10, 2016 10:01 AM
I have a handy Applescript that cleans up text copied from Yelp pages. it extracts and formats address/phone/hours data for the given venue via a series of search/replace actions. I also want to compress the hours-of-operation data, which is super-fluffy, but that will require some higher logic (see examples below).
I'm assuming this is a pretty trivial task for a competent coder, and hope $25 is sufficient (the convenience provided by this wouldn't be worth more than that for me). Please provide scripting I can simply add to my Applescript.
Four actions:
1. Whenever data is identical for two (but no more than two) consecutive days, slash-separate the days (e.g. Thu/Fri 9-5).
2. Whenever data is identical for more than two consecutive days, dash separate the days (e.g. Thu-Sun 9-5).
3. Leave days consecutive. In Example 3, data for Monday and Thursday are identical, but we won't group them because they're non-consecutive.
4. Work "Around the Corner". Data always begins with Monday and ends with Sunday, but group Sunday and Monday according to rules 1 and 2, since they're consecutive. (see examples 1, 2, 4, and 7).
Here are loads of examples, just to be clear. The "Before" data is exactly what you'd be working on (it's already been processed some by my script):
==========
Example 1
Before:
Mon 11 - 4; Tue Closed; Wed Closed; Thu 11 - 4; Fri 11 - 4; Sat 11 - 4 ; Sun 11 - 4
After:
Tue/Wed Closed; Thu-Mon 11 - 4
==========
Example 2
Before:
Mon 11-4; Tue 11-9; Wed 11-9; Thu 11-9; Fri 11-9; Sat 11-9; Sun 11-4
After:
Sun/Mon 11-4; Tue-Sat 11-9
==========
Example 3
Before:
Mon 5-12:30 am; Tue Closed; Wed Closed; Thu 6-12:30 am; Fri 6-12:30 am; Sat 5-12:30 am; Sun Closed
After:
Mon 5-12:30 am; Tue/Wed Closed; Thu/Fri 6-12:30 am; Sat 5-12:30 am; Sun Closed
==========
Example 4
Before:
Mon 8-10; Tue 8-10; Wed 8-10; Thu 8-10; Fri 8-11; Sat 8-11; Sun 8-10
After:
Sun- Thu 8-10; Fri/Sat 8-11
==========
Example 5
Before:
Mon 5-9; Tue Closed; Wed 5-9; Thu 5-9; Fri 5-10; Sat 5-10; Sun 11-1:45 pm
5-8:30 pm
After:
Mon 5-9; Tue Closed; Wed/Thurs 5-9; Fri/Sat 5-10; Sun 11-1:45 pm
5-8:30 pm
==========
Example 6
Before:
Mon Closed; Tue Closed; Wed Closed; Thu 5-11; Fri 3-11; Sat 12-12; Sun 1-8
After:
Mon-Wed Closed; Thu 5-11; Fri 3-11; Sat 12-12; Sun 1-8
==========
Example 7
Before:
Mon 11-9; Tue 11-9; Wed 11-9; Thu 11-9; Fri 11-10; Sat 11-10; Sun 11-9
After:
Sun-Thurs 11 - 9; Fri/Sat 11 - 10
NOTE: if anyone out there wants my Yelp clean-up script once it's complete, just MeMail me, you're welcome to it.
payscale: $25
job type: part-time
I'm assuming this is a pretty trivial task for a competent coder, and hope $25 is sufficient (the convenience provided by this wouldn't be worth more than that for me). Please provide scripting I can simply add to my Applescript.
Four actions:
1. Whenever data is identical for two (but no more than two) consecutive days, slash-separate the days (e.g. Thu/Fri 9-5).
2. Whenever data is identical for more than two consecutive days, dash separate the days (e.g. Thu-Sun 9-5).
3. Leave days consecutive. In Example 3, data for Monday and Thursday are identical, but we won't group them because they're non-consecutive.
4. Work "Around the Corner". Data always begins with Monday and ends with Sunday, but group Sunday and Monday according to rules 1 and 2, since they're consecutive. (see examples 1, 2, 4, and 7).
Here are loads of examples, just to be clear. The "Before" data is exactly what you'd be working on (it's already been processed some by my script):
==========
Example 1
Before:
Mon 11 - 4; Tue Closed; Wed Closed; Thu 11 - 4; Fri 11 - 4; Sat 11 - 4 ; Sun 11 - 4
After:
Tue/Wed Closed; Thu-Mon 11 - 4
==========
Example 2
Before:
Mon 11-4; Tue 11-9; Wed 11-9; Thu 11-9; Fri 11-9; Sat 11-9; Sun 11-4
After:
Sun/Mon 11-4; Tue-Sat 11-9
==========
Example 3
Before:
Mon 5-12:30 am; Tue Closed; Wed Closed; Thu 6-12:30 am; Fri 6-12:30 am; Sat 5-12:30 am; Sun Closed
After:
Mon 5-12:30 am; Tue/Wed Closed; Thu/Fri 6-12:30 am; Sat 5-12:30 am; Sun Closed
==========
Example 4
Before:
Mon 8-10; Tue 8-10; Wed 8-10; Thu 8-10; Fri 8-11; Sat 8-11; Sun 8-10
After:
Sun- Thu 8-10; Fri/Sat 8-11
==========
Example 5
Before:
Mon 5-9; Tue Closed; Wed 5-9; Thu 5-9; Fri 5-10; Sat 5-10; Sun 11-1:45 pm
5-8:30 pm
After:
Mon 5-9; Tue Closed; Wed/Thurs 5-9; Fri/Sat 5-10; Sun 11-1:45 pm
5-8:30 pm
==========
Example 6
Before:
Mon Closed; Tue Closed; Wed Closed; Thu 5-11; Fri 3-11; Sat 12-12; Sun 1-8
After:
Mon-Wed Closed; Thu 5-11; Fri 3-11; Sat 12-12; Sun 1-8
==========
Example 7
Before:
Mon 11-9; Tue 11-9; Wed 11-9; Thu 11-9; Fri 11-10; Sat 11-10; Sun 11-9
After:
Sun-Thurs 11 - 9; Fri/Sat 11 - 10
NOTE: if anyone out there wants my Yelp clean-up script once it's complete, just MeMail me, you're welcome to it.
payscale: $25
job type: part-time
This job has been filled.