Re: [OT] Up is down

2018-09-01 Thread Mark Wieder via use-livecode

On 09/01/2018 04:54 PM, J. Landman Gay via use-livecode wrote:
On September 1, 2018 6:34:17 PM Mark Wieder via use-livecode 
 wrote:



On 09/01/2018 02:48 PM, J. Landman Gay via use-livecode wrote:

No, it's a little north-east of center.


Wait. What? West is north-east of center?


Of course. When you're that far south, everything is north. I assume 
their center must be somewhat dynamic, perhaps based on where the most 
cattle are at the moment.


Probably a good idea to move your scenter to where the cattle aren't.

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: [OT] Accommodation in Edinburgh

2018-09-01 Thread Colin Holgate via use-livecode
For the last conference in Edinburgh I used AirBNB. It worked out well, and I 
biked to the conference each day in a few minutes.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: [OT] Accommodation in Edinburgh

2018-09-01 Thread Jim Lambert via use-livecode
> Hugh wrote:

> We are (finally!) taking a week's holiday north of the border and want to
> visit Edinburgh 10-15 September.
> Any hotel recommendations? Does not have to be in the city centre!
> 


These are not hotels. But we have stayed at both of these charming apartments.
Hidden Glen was quite near the Tollcross location of the previous LC Conference.
Both are owned by the family that owns The Three Chimneys on Skye, which is an 
exceptionally elegant inn/restaurant.

Old School Tower @ Holyrood Park
1/9 Saint Leonard's Crag, Edinburgh, EH8 9SP
https://www.airbnb.com/rooms/2667737?sug=50 


Hidden Glen Apartments: Glendale
22 Glen Street, Tollcross, Edinburgh, EH3 9JE
https://www.airbnb.com/rooms/8354483?sug=50 


These and others are also directly available through Gillian Taylor & Ewen 
MacAskill’s own site:
www.edinburghhideaways.com 

Stayed at The Scotsman once. They gave us a free upgrade to the penthouse. 
Spectacular! So, of course, we recommend that hotel. ;)
Also The George in New Town is nice.

Hope this helps.

Jim Lambert
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

[OT] Up is down (was: Searching for a word when it's more than one word)

2018-09-01 Thread J. Landman Gay via use-livecode
On September 1, 2018 6:34:17 PM Mark Wieder via use-livecode 
 wrote:



On 09/01/2018 02:48 PM, J. Landman Gay via use-livecode wrote:

No, it's a little north-east of center.


Wait. What? West is north-east of center?


Of course. When you're that far south, everything is north. I assume their 
center must be somewhat dynamic, perhaps based on where the most cattle are 
at the moment.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Mark Wieder via use-livecode

On 09/01/2018 02:48 PM, J. Landman Gay via use-livecode wrote:

No, it's a little north-east of center.


Wait. What? West is north-east of center?

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread J. Landman Gay via use-livecode

No, it's a little north-east of center.

On 9/1/18 12:02 PM, Richmond Mathewson via use-livecode wrote:

Is West, Texas in West Texas?

Richmond.

On 1/9/2018 6:55 pm, Mark Wieder via use-livecode wrote:

On 09/01/2018 08:39 AM, J. Landman Gay via use-livecode wrote:
There is a town in Texas called West, made infamous a few years ago 
by a giant explosion. I don't think you can make assumptions about 
names of places.


And thus the distinction between West Texas and West, Texas.



--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread J. Landman Gay via use-livecode

On 9/1/18 10:55 AM, Mark Wieder via use-livecode wrote:

On 09/01/2018 08:39 AM, J. Landman Gay via use-livecode wrote:
There is a town in Texas called West, made infamous a few years ago by 
a giant explosion. I don't think you can make assumptions about names 
of places.


And thus the distinction between West Texas and West, Texas.



When I first heard it on the news, I thought half of Texas had 
disappeared. I had mixed feelings when I found out it didn't.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode

East or West, home is a comfy LiveCode stack . . .

Well; here's my third version, which does better than the first 2:

https://www.dropbox.com/s/r3yocmqzwhwu4ta/Text%20analyzer%20X.livecode.zip?dl=0

Richmond.

On 1/9/2018 6:39 pm, J. Landman Gay via use-livecode wrote:
There is a town in Texas called West, made infamous a few years ago by 
a giant explosion. I don't think you can make assumptions about names 
of places.


Mark's suggestion to check for words ending in "s" will fail on many 
towns, though apostrophe-s may be safe.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On September 1, 2018 5:49:30 AM Richmond Mathewson via use-livecode 
 wrote:



I can see that the "problem", which my stack does not address, is with 2
or 3 part place names:

The Rochester/Chester problem is easily dealt with.

While it should be realtively easy to have a subroutine to deal with
words such as "West" (after all, there are no places just called 
"West"),

places like a town my parents once lived in called "Haselbury Plucknett"
would cause problems.

AND, places such as "Ruyton of the Eleven Towns"
(https://en.wikipedia.org/wiki/Ruyton-XI-Towns)
would really throw a spanner in the works.

Come to think of things . . .

Unless anyone's code can cope with "Ruyton of the Eleven Towns" it won't
stand up: we could even go further and call
this the "Ruyton of the Eleven Towns Test".

More muffled background noises.

Richmond.

On 1/9/2018 1:29 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 12:05, Richmond Mathewson via use-livecode wrote:

Obviously, when considering names of places such as Colchester,
Rochester and Chester one has
to search for the longer names first and exclude them from later
searches.


The 'substring' problem (i.e. Chester being 'in' Rochester) isn't
relevant in the above algorithm because we are 'tokenising' input and
phrases - essentially changing the alphabet.

i.e. "Rochester Chester Colchester" is turned into ABC, and we match
A, B or C as atomic units.

I should perhaps point out that the 'processText' operation probably
needs to be a little better in practice - to at least include a 'stop'
token for punctuation. For example:

"The man walked starting from East Hartford, West Hartford could be
seen in the distance."

In the case where 'Hartford West' and 'Hartford' are the 'known' towns
(and not 'East Hartford') - the proposed tokenization would result in:

The,man,walked,starting,from,East,Hartford,West,Hartford,could,be,seen,in,the,distance 



Which means you'd get "Hartford West" and "Hartford" - when you should
only get "Hartford" (assuming you care about the linguistic structure
of the text, at least).

Indeed, the above actually means in preprocessing the text, you can
actually vastly reduce the number of words to search - any sequences
of words which aren't in any pharse (or important punctuation) can be
replaced by "*" say. So the above would become:

*,East,Hartford,*,West,Hartford,*

The "*" tokens block matching multi-word phrases.

Warmest Regards,

Mark.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Chunked Off

2018-09-01 Thread Mark Wieder via use-livecode

On 09/01/2018 09:58 AM, Richmond Mathewson via use-livecode wrote:

I suspect that is EXACTLY what I am looking for.

Thank you very much indeed.


!! I find myself much surprised that I have actually managed to 
accomplish a task before finishing my first cup of coffee of the day. I 
think I'll rest on my laurels (not quite sure of the literal meaning of 
that phrase - it sounds uncomfortable) and spend some time away from the 
computer and go for a hike instead.


--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


tabMode request for WP-style tabAlign

2018-09-01 Thread Curry Kenworthy via use-livecode



I have submitted a feature request for word processing style tab stop 
aligns:




https://quality.livecode.com/show_bug.cgi?id=21554

Current LC 7+ tabAlign is perfect for columns, including tables. That's 
because it is, in fact, column alignment.


Each text is positioned left/center/right within its column, which is 
the space BETWEEN two tabs.


However, that's very different than word processing tab stops.
Except in tables, Word processors align text relative to the tab stop 
itself.


For example:

1. Make a field.

2. Enter a line of text with some tabs between phrases.

3. Try to center text around the tabstop itself rather than the column 
space between tabs.


Expected: text centers around tab stop position.

Current: text centers in space between tab stops.

Desired: tabMode to allow both align behaviors. Both modes are needed. 
They are different.


(See the test stack attached in the QA report; right/left are also 
different, not just center.)


It's possible to hack in workarounds for this, but they are imperfect.

So, for anyone who has noticed this and wanted true WP-style tab stops, 
here's a request that you can sign onto. I propose the tabMode property 
per line (or p) of text.


(And for anyone who hasn't noticed the difference yet, here's a chance 
to learn more about tabs; sign onto the request if you would like to see 
this feature.)


I couldn't find any existing requests for this, so if there have been, 
or if any other ideas, feel free to add.


This would be very useful for WordLib, and I'm sure for many other 
LiveCode projects, since people use such a great amount and variety of 
text and text entry in LC. Thanks.


Best wishes,

Curry Kenworthy

Custom Software Development
LiveCode Training and Consulting
http://livecodeconsulting.com/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode

We're all in a state at the moment with this one.

Richmond.

On 1/9/2018 7:24 pm, Stephen MacLean via use-livecode wrote:

Thankfully, in my case, I do know what at least the state is:)


On Sep 1, 2018, at 11:55 AM, Mark Wieder via use-livecode 
 wrote:


On 09/01/2018 08:39 AM, J. Landman Gay via use-livecode wrote:
There is a town in Texas called West, made infamous a few years ago by a giant 
explosion. I don't think you can make assumptions about names of places.

And thus the distinction between West Texas and West, Texas.

--
Mark Wieder
ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode

Is West, Texas in West Texas?

Richmond.

On 1/9/2018 6:55 pm, Mark Wieder via use-livecode wrote:

On 09/01/2018 08:39 AM, J. Landman Gay via use-livecode wrote:
There is a town in Texas called West, made infamous a few years ago 
by a giant explosion. I don't think you can make assumptions about 
names of places.


And thus the distinction between West Texas and West, Texas.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: [OT] Accommodation in Edinburgh

2018-09-01 Thread Richmond Mathewson via use-livecode
If you get there bfore the University year starts one of the *best, and 
relatively inexpensive, places

to stay is the Pollok Halls student residences:

https://www.edinburghfirst.co.uk/for-accommodation/pollock-halls/

I stayed there last when I attended a LiveCode conference a few years back.

Richmond.
*
On 1/9/2018 6:54 pm, FlexibleLearning.com via use-livecode wrote:

We are (finally!) taking a week's holiday north of the border and want to
visit Edinburgh 10-15 September.


Any hotel recommendations? Does not have to be in the city centre!

Hugh


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Chunked Off

2018-09-01 Thread Richmond Mathewson via use-livecode

I suspect that is EXACTLY what I am looking for.

Thank you very much indeed.

Richmond.

On 1/9/2018 6:54 pm, Mark Wieder via use-livecode wrote:

On 09/01/2018 06:22 AM, Richmond Mathewson via use-livecode wrote:

I've got a text, in a field ("xText"), that contains the phrase 
"Ruyton of the Eleven Towns."


Now what I would like to do is dlete the chunk "Ruyton of the Eleven 
Towns."


from the string variable . . . BUT . . . if I "try to be clever":


Probably not what you're looking for, but...

the not-clever approach:
replace "Ruyton of the Eleven Towns." with empty in exText

or directly:
replace "Ruyton of the Eleven Towns." with empty in field "xText"



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode

That sounds remarkably like two women who are friends of my parents:

One is called "Gay" and the other one is called "Loveday". They were 
friends at school 60 years ago
and when they were both widowed they moved in together; although the son 
of one of them fell out

with his wife and now lives with them as well.

Assumptions are sometimes difficult to avoid.

Although my younger son did actually dislocate his knee jumping to 
conclusions . . .


This was mainly because he was trying to skip a difficult bit . . .

But I digress.

Richmond.

On 1/9/2018 6:39 pm, J. Landman Gay via use-livecode wrote:
There is a town in Texas called West, made infamous a few years ago by 
a giant explosion. I don't think you can make assumptions about names 
of places.


Mark's suggestion to check for words ending in "s" will fail on many 
towns, though apostrophe-s may be safe.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On September 1, 2018 5:49:30 AM Richmond Mathewson via use-livecode 
 wrote:



I can see that the "problem", which my stack does not address, is with 2
or 3 part place names:

The Rochester/Chester problem is easily dealt with.

While it should be realtively easy to have a subroutine to deal with
words such as "West" (after all, there are no places just called 
"West"),

places like a town my parents once lived in called "Haselbury Plucknett"
would cause problems.

AND, places such as "Ruyton of the Eleven Towns"
(https://en.wikipedia.org/wiki/Ruyton-XI-Towns)
would really throw a spanner in the works.

Come to think of things . . .

Unless anyone's code can cope with "Ruyton of the Eleven Towns" it won't
stand up: we could even go further and call
this the "Ruyton of the Eleven Towns Test".

More muffled background noises.

Richmond.

On 1/9/2018 1:29 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 12:05, Richmond Mathewson via use-livecode wrote:

Obviously, when considering names of places such as Colchester,
Rochester and Chester one has
to search for the longer names first and exclude them from later
searches.


The 'substring' problem (i.e. Chester being 'in' Rochester) isn't
relevant in the above algorithm because we are 'tokenising' input and
phrases - essentially changing the alphabet.

i.e. "Rochester Chester Colchester" is turned into ABC, and we match
A, B or C as atomic units.

I should perhaps point out that the 'processText' operation probably
needs to be a little better in practice - to at least include a 'stop'
token for punctuation. For example:

"The man walked starting from East Hartford, West Hartford could be
seen in the distance."

In the case where 'Hartford West' and 'Hartford' are the 'known' towns
(and not 'East Hartford') - the proposed tokenization would result in:

The,man,walked,starting,from,East,Hartford,West,Hartford,could,be,seen,in,the,distance 



Which means you'd get "Hartford West" and "Hartford" - when you should
only get "Hartford" (assuming you care about the linguistic structure
of the text, at least).

Indeed, the above actually means in preprocessing the text, you can
actually vastly reduce the number of words to search - any sequences
of words which aren't in any pharse (or important punctuation) can be
replaced by "*" say. So the above would become:

*,East,Hartford,*,West,Hartford,*

The "*" tokens block matching multi-word phrases.

Warmest Regards,

Mark.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Stephen MacLean via use-livecode
Thankfully, in my case, I do know what at least the state is:)

> On Sep 1, 2018, at 11:55 AM, Mark Wieder via use-livecode 
>  wrote:
> 
>> On 09/01/2018 08:39 AM, J. Landman Gay via use-livecode wrote:
>> There is a town in Texas called West, made infamous a few years ago by a 
>> giant explosion. I don't think you can make assumptions about names of 
>> places.
> 
> And thus the distinction between West Texas and West, Texas.
> 
> -- 
> Mark Wieder
> ahsoftw...@gmail.com
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


ImageHandles_v105

2018-09-01 Thread hh via use-livecode
Just uploaded hhImageHandles to "Sample Stacks".

This is a group of handles that is attachable to any image.
All you have to do (after copying the group to your stack):
send "setTarget " to group "hhPoly"

Base position of the 9 handles (use a monospaced font):
   ###
   ## 1 ##
   ## | ##
   ## 9 - 2 - 3 ##
   ## |   | ##
   ## 8   4 ##
   ## |   | ##
   ## 7 - 6 - 5 ##
   ###
Actions:
a=Click and drag, b=Shift-Click or RightClick and drag

1: (a) Rotate, (b) Reset shape
2,6: (a) Height, (b) SkewX
4,8: (a) Width,  (b) SkewY
3,5,7,9: (a) 4-Point-Distortion
3,5,7,9: (b) ProportionalResize

Rotation is around the shapes's centroid (which can also be shown).

Changing height, width or proportional resizing preserves the
current shape!

hhImageHandles works on Mac/Win/Linux and comes in two variants.

[1] livecodeshare.runrev.com/stack/893
hhImageHandles6_LCS (pure LCScript) is for LC 6/7/8/9,
fast enough (only) on LC 6.

[2] livecodeshare.runrev.com/stack/894
hhImageHandles89B has the option to use JavaScript (of a browser
widget) and is with that at about 15-20 faster as LCS. 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Mark Wieder via use-livecode

On 09/01/2018 08:39 AM, J. Landman Gay via use-livecode wrote:
There is a town in Texas called West, made infamous a few years ago by a 
giant explosion. I don't think you can make assumptions about names of 
places.


And thus the distinction between West Texas and West, Texas.

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


[OT] Accommodation in Edinburgh

2018-09-01 Thread FlexibleLearning.com via use-livecode
We are (finally!) taking a week's holiday north of the border and want to
visit Edinburgh 10-15 September.


Any hotel recommendations? Does not have to be in the city centre!

Hugh


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Chunked Off

2018-09-01 Thread Mark Wieder via use-livecode

On 09/01/2018 06:22 AM, Richmond Mathewson via use-livecode wrote:

I've got a text, in a field ("xText"), that contains the phrase "Ruyton 
of the Eleven Towns."


Now what I would like to do is dlete the chunk "Ruyton of the Eleven 
Towns."


from the string variable . . . BUT . . . if I "try to be clever":


Probably not what you're looking for, but...

the not-clever approach:
replace "Ruyton of the Eleven Towns." with empty in exText

or directly:
replace "Ruyton of the Eleven Towns." with empty in field "xText"

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread J. Landman Gay via use-livecode
There is a town in Texas called West, made infamous a few years ago by a 
giant explosion. I don't think you can make assumptions about names of places.


Mark's suggestion to check for words ending in "s" will fail on many towns, 
though apostrophe-s may be safe.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On September 1, 2018 5:49:30 AM Richmond Mathewson via use-livecode 
 wrote:



I can see that the "problem", which my stack does not address, is with 2
or 3 part place names:

The Rochester/Chester problem is easily dealt with.

While it should be realtively easy to have a subroutine to deal with
words such as "West" (after all, there are no places just called "West"),
places like a town my parents once lived in called "Haselbury Plucknett"
would cause problems.

AND, places such as "Ruyton of the Eleven Towns"
(https://en.wikipedia.org/wiki/Ruyton-XI-Towns)
would really throw a spanner in the works.

Come to think of things . . .

Unless anyone's code can cope with "Ruyton of the Eleven Towns" it won't
stand up: we could even go further and call
this the "Ruyton of the Eleven Towns Test".

More muffled background noises.

Richmond.

On 1/9/2018 1:29 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 12:05, Richmond Mathewson via use-livecode wrote:

Obviously, when considering names of places such as Colchester,
Rochester and Chester one has
to search for the longer names first and exclude them from later
searches.


The 'substring' problem (i.e. Chester being 'in' Rochester) isn't
relevant in the above algorithm because we are 'tokenising' input and
phrases - essentially changing the alphabet.

i.e. "Rochester Chester Colchester" is turned into ABC, and we match
A, B or C as atomic units.

I should perhaps point out that the 'processText' operation probably
needs to be a little better in practice - to at least include a 'stop'
token for punctuation. For example:

"The man walked starting from East Hartford, West Hartford could be
seen in the distance."

In the case where 'Hartford West' and 'Hartford' are the 'known' towns
(and not 'East Hartford') - the proposed tokenization would result in:

The,man,walked,starting,from,East,Hartford,West,Hartford,could,be,seen,in,the,distance

Which means you'd get "Hartford West" and "Hartford" - when you should
only get "Hartford" (assuming you care about the linguistic structure
of the text, at least).

Indeed, the above actually means in preprocessing the text, you can
actually vastly reduce the number of words to search - any sequences
of words which aren't in any pharse (or important punctuation) can be
replaced by "*" say. So the above would become:

*,East,Hartford,*,West,Hartford,*

The "*" tokens block matching multi-word phrases.

Warmest Regards,

Mark.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


startUp messaging hierarchy

2018-09-01 Thread FlexibleLearning.com via use-livecode
I find myself unable to answer this rather basic question, and cannot locate
any information...

e.g.
This is both incomplete and also most likely incorrect...

startUp (if engine is not already loaded)
- frontScript:
-- PreOpenStack
-- PreOpenCard
-- openStack
-- openCard
-- preOpenBackGround
-- openBackground

preOpenStack
preOpenCard
openStack
openCard
preOpenBackground (if closed)
openBackground (if closed)

- backscript:
-- PreOpenStack
-- PreOpenCard
-- openStack
-- openCard
-- preOpenBackGround
-- openBackground

Anyone?

Hugh


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Chunked Off

2018-09-01 Thread Richmond Mathewson via use-livecode

Yup: a lot.

I've got a text, in a field ("xText"), that contains the phrase "Ruyton 
of the Eleven Towns."


[ Don't worry why it is "Ruyton of the Eleven Towns.": just part of an 
ongoing, slightly kinky relationship with someone at LC central. ]


Now . . .

I can do this sort of thing:

on mouseDown
   put empty into fld "zText"
   put fld "xText" into exTEXT
   if matchChunk(exText,"Ruyton of the Eleven Towns.")  then
  --do something magical
  end if
end mouseDown

And the matchChunk will prove positive . . .

Now what I would like to do is dlete the chunk "Ruyton of the Eleven Towns."

from the string variable . . . BUT . . . if I "try to be clever":

on mouseDown
   put empty into fld "zText"
   put fld "xText" into exTEXT
   put "Ruyton of the Eleven Towns." into CHK
   if matchChunk(exText,CHK)  then
delete CHK from exTEXT
  end if
end mouseDown

the coloured line throws a "big, bad, bluey".

Richmond.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Stephen MacLean via use-livecode
Wow, this is awesome, thank you all!!

Sorry, on the road taking my daughter to college, would love to try some of 
this out. 

One thing to keep in mind is that as that I’m checking for names against the 
town list, I may not know what town I’m actually looking for. Usually i do, but 
not always. 

Therefore i’ve been counting how many of each name I’ve come across and do some 
calculations at the end to make a best guess. 

Really appreciate the responses!!

Thank you,

Steve

> On Sep 1, 2018, at 7:53 AM, Richmond Mathewson via use-livecode 
>  wrote:
> 
> 
> 
>> On 1/9/2018 2:50 pm, Mark Waddingham via use-livecode wrote:
>>> On 2018-09-01 13:15, Richmond Mathewson via use-livecode wrote:
>>> I've already shovelled Ruyton of the Eleven Towns quite effectively:
>>> 
>>> https://www.dropbox.com/s/n7r7u0c2m9ny3eb/Text%20analyzer%20X.livecode.zip?dl=0
>>>  
>>> 
>>> No tokenising, in fact very basic stuff indeed.
>>> 
>>> Not wishing to bang on about over-complcating things . . . . .
>> 
>> There is actually a 'correct' more shovelistic approach (at least I *think* 
>> this is correct):
>> 
>> -- Ensure all punctuation is surrounded by space
>> repeat for each char tPuncChar in ",.';:()[]{}<>!@£$%^&*-_+=~`?/\|#€" & quote
>>  replace tPuncChar with space & tPuncChar & space in tText
>> end repeat
> 
> Thats a "point" (pun intended) as I just fell foul of a full stop.
>> 
>> -- Ensure all whitespace is space
>> replace return with space in tText
>> replace tab with space in tText
>> 
>> -- Ensure there is never two spaces next to each other in tText
>> repeat while tText contains "  "
>>  replace "  " with " " in tText
>> end repeat
>> 
>> -- Ensure there is only ever one space between words in phrases
>> repeat while tPhrases contains "  "
>>  replace "  " with " " in tPhrases
>> end repeat
>> 
>> -- We can now use an itemDelimiter of space
>> set the itemDelimiter to space
>> 
>> -- Sort the phrases by descending word length.
>> sort lines of tPhrases descending numeric by the number of items in each
>> 
>> -- Now check for, and remove each phrase from the source text in turn
>> set the wholeMatches to true
>> repeat for each line tPhrase in tPhrases
>>  -- If the phrase is not present then skip to the next
>>  if itemOffset(tPhrase, tText) is 0 then
>>next repeat
>>  end if
>> 
>>  -- Accumulate the phrase on the output list
>>  put tPhrase & return after tFoundPhrases
>> 
>>  -- Remove the phrase from the input text (we assume here that * does not 
>> appear in any phrase)
>>  replace tPhrase with "*" in tText
>> end repeat
>> 
>> Warmest Regards,
>> 
>> Mark.
>> 
>> P.S. The above will be reasonable quick for small sets of phrases / small 
>> source texts - but I think as the size of either increases it will get very 
>> slow, very quickly!
>> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode



On 1/9/2018 2:50 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 13:15, Richmond Mathewson via use-livecode wrote:

I've already shovelled Ruyton of the Eleven Towns quite effectively:

https://www.dropbox.com/s/n7r7u0c2m9ny3eb/Text%20analyzer%20X.livecode.zip?dl=0 



No tokenising, in fact very basic stuff indeed.

Not wishing to bang on about over-complcating things . . . . .


There is actually a 'correct' more shovelistic approach (at least I 
*think* this is correct):


-- Ensure all punctuation is surrounded by space
repeat for each char tPuncChar in ",.';:()[]{}<>!@£$%^&*-_+=~`?/\|#€" 
& quote

  replace tPuncChar with space & tPuncChar & space in tText
end repeat


Thats a "point" (pun intended) as I just fell foul of a full stop.


-- Ensure all whitespace is space
replace return with space in tText
replace tab with space in tText

-- Ensure there is never two spaces next to each other in tText
repeat while tText contains "  "
  replace "  " with " " in tText
end repeat

-- Ensure there is only ever one space between words in phrases
repeat while tPhrases contains "  "
  replace "  " with " " in tPhrases
end repeat

-- We can now use an itemDelimiter of space
set the itemDelimiter to space

-- Sort the phrases by descending word length.
sort lines of tPhrases descending numeric by the number of items in each

-- Now check for, and remove each phrase from the source text in turn
set the wholeMatches to true
repeat for each line tPhrase in tPhrases
  -- If the phrase is not present then skip to the next
  if itemOffset(tPhrase, tText) is 0 then
next repeat
  end if

  -- Accumulate the phrase on the output list
  put tPhrase & return after tFoundPhrases

  -- Remove the phrase from the input text (we assume here that * does 
not appear in any phrase)

  replace tPhrase with "*" in tText
end repeat

Warmest Regards,

Mark.

P.S. The above will be reasonable quick for small sets of phrases / 
small source texts - but I think as the size of either increases it 
will get very slow, very quickly!





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode

It didn't like this:

on mouseDown
   put empty into fld "zText"
   if fld "xText" contains "Ruyton of the Eleven Towns." then
  put fld "xText" into fld "zText"
  put "Ruyton of the Eleven Towns." into CHUNNK
put empty into CHUNNK of fld "zText"
  end if
*end mouseDown**
**
**Richmond.*

On 1/9/2018 2:25 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 13:15, Richmond Mathewson via use-livecode wrote:

I've already shovelled Ruyton of the Eleven Towns quite effectively:

https://www.dropbox.com/s/n7r7u0c2m9ny3eb/Text%20analyzer%20X.livecode.zip?dl=0 



No tokenising, in fact very basic stuff indeed.

Not wishing to bang on about over-complcating things . . . . .


Your revised approach is fine - as long as the names of all the towns 
are distinct in terms of no one town's name is contained within another.


Add 'Palm Beach West' and 'Palm Beach' to your placeNames list; then 
modify your source text to end 'or Palm Beach West' - and you 
algorithm does not perform the requested operation.


It reports Palm Beach West *and* Palm Beach as being present - 
whereas, only 'Palm Beach West' is present :D


Warmest Regards,

Mark.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Mark Waddingham via use-livecode

On 2018-09-01 13:15, Richmond Mathewson via use-livecode wrote:

I've already shovelled Ruyton of the Eleven Towns quite effectively:

https://www.dropbox.com/s/n7r7u0c2m9ny3eb/Text%20analyzer%20X.livecode.zip?dl=0

No tokenising, in fact very basic stuff indeed.

Not wishing to bang on about over-complcating things . . . . .


There is actually a 'correct' more shovelistic approach (at least I 
*think* this is correct):


-- Ensure all punctuation is surrounded by space
repeat for each char tPuncChar in ",.';:()[]{}<>!@£$%^&*-_+=~`?/\|#€" & 
quote

  replace tPuncChar with space & tPuncChar & space in tText
end repeat

-- Ensure all whitespace is space
replace return with space in tText
replace tab with space in tText

-- Ensure there is never two spaces next to each other in tText
repeat while tText contains "  "
  replace "  " with " " in tText
end repeat

-- Ensure there is only ever one space between words in phrases
repeat while tPhrases contains "  "
  replace "  " with " " in tPhrases
end repeat

-- We can now use an itemDelimiter of space
set the itemDelimiter to space

-- Sort the phrases by descending word length.
sort lines of tPhrases descending numeric by the number of items in each

-- Now check for, and remove each phrase from the source text in turn
set the wholeMatches to true
repeat for each line tPhrase in tPhrases
  -- If the phrase is not present then skip to the next
  if itemOffset(tPhrase, tText) is 0 then
next repeat
  end if

  -- Accumulate the phrase on the output list
  put tPhrase & return after tFoundPhrases

  -- Remove the phrase from the input text (we assume here that * does 
not appear in any phrase)

  replace tPhrase with "*" in tText
end repeat

Warmest Regards,

Mark.

P.S. The above will be reasonable quick for small sets of phrases / 
small source texts - but I think as the size of either increases it will 
get very slow, very quickly!


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode




On 1/9/2018 2:25 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 13:15, Richmond Mathewson via use-livecode wrote:

I've already shovelled Ruyton of the Eleven Towns quite effectively:

https://www.dropbox.com/s/n7r7u0c2m9ny3eb/Text%20analyzer%20X.livecode.zip?dl=0 



No tokenising, in fact very basic stuff indeed.

Not wishing to bang on about over-complcating things . . . . .


Your revised approach is fine - as long as the names of all the towns 
are distinct in terms of no one town's name is contained within another.


Blast!

Of course "my next trick" is to work out how to delete multi-word names 
(i.e. phrases) from a textField.


Richmond.


Add 'Palm Beach West' and 'Palm Beach' to your placeNames list; then 
modify your source text to end 'or Palm Beach West' - and you 
algorithm does not perform the requested operation.


It reports Palm Beach West *and* Palm Beach as being present - 
whereas, only 'Palm Beach West' is present :D


Warmest Regards,

Mark.




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Mark Waddingham via use-livecode

On 2018-09-01 13:15, Richmond Mathewson via use-livecode wrote:

I've already shovelled Ruyton of the Eleven Towns quite effectively:

https://www.dropbox.com/s/n7r7u0c2m9ny3eb/Text%20analyzer%20X.livecode.zip?dl=0

No tokenising, in fact very basic stuff indeed.

Not wishing to bang on about over-complcating things . . . . .


Your revised approach is fine - as long as the names of all the towns 
are distinct in terms of no one town's name is contained within another.


Add 'Palm Beach West' and 'Palm Beach' to your placeNames list; then 
modify your source text to end 'or Palm Beach West' - and you algorithm 
does not perform the requested operation.


It reports Palm Beach West *and* Palm Beach as being present - whereas, 
only 'Palm Beach West' is present :D


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode

I've already shovelled Ruyton of the Eleven Towns quite effectively:

https://www.dropbox.com/s/n7r7u0c2m9ny3eb/Text%20analyzer%20X.livecode.zip?dl=0

No tokenising, in fact very basic stuff indeed.

Not wishing to bang on about over-complcating things . . . . .

Probably time for both Thee and Me to get out and get some fresh air 
before we ruin our weekends.


Richmond.

On 1/9/2018 2:05 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 12:50, Richmond Mathewson via use-livecode wrote:

Yup: indeed: fairly coarse.

However, see my next posting re "Ruyton of the Eleven Towns"

that should make some folk feel that they need a set of sewing needles
rather than "just" a silver teaspoon.


I think you'll find my 'silver teaspoon' approach (as you put it) 
deals with all those cases :D


Interestingly, as I said, the multi-word match problem can be reduced 
to your 'shovel' - with pre and post processing.


Let's say that the phrase list is:

  Ruyton of the Eleven Towns
  East Hartfordshire
  Colchester
  Chester

First create a mapping from phrase words to individual characters (the 
choice of character is arbitrary):


  Ruyton <-> A
  of <-> B
  the <-> C
  Eleven <-> D
  Towns <-> E
  East <-> F
  Hartfordshire <-> G
  Colchester <-> H
  Chester <-> I

Now iterate through the source text, generating an output source text 
consisting of words from the new alphabet, and a 'unknown' letter '*'. 
For example:


  The man from Ruyton of the Eleven Towns, who is of the order of 
shovels, travelled from Chester to Colchester via the towns in East 
Hartfordshire


Would become:

  C**ABCDE**BC*B***I*H**E*FG

The original phrase list is processed similarly to give:

  ABCDE
  FG
  H
  I

Searching the transformed source text using your algorithm with the 
list of transformed phrases would give the correct set of found 
phrases as required by the original problem.


Warmest Regards,

Mark.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Mark Waddingham via use-livecode

On 2018-09-01 12:50, Richmond Mathewson via use-livecode wrote:

Yup: indeed: fairly coarse.

However, see my next posting re "Ruyton of the Eleven Towns"

that should make some folk feel that they need a set of sewing needles
rather than "just" a silver teaspoon.


I think you'll find my 'silver teaspoon' approach (as you put it) deals 
with all those cases :D


Interestingly, as I said, the multi-word match problem can be reduced to 
your 'shovel' - with pre and post processing.


Let's say that the phrase list is:

  Ruyton of the Eleven Towns
  East Hartfordshire
  Colchester
  Chester

First create a mapping from phrase words to individual characters (the 
choice of character is arbitrary):


  Ruyton <-> A
  of <-> B
  the <-> C
  Eleven <-> D
  Towns <-> E
  East <-> F
  Hartfordshire <-> G
  Colchester <-> H
  Chester <-> I

Now iterate through the source text, generating an output source text 
consisting of words from the new alphabet, and a 'unknown' letter '*'. 
For example:


  The man from Ruyton of the Eleven Towns, who is of the order of 
shovels, travelled from Chester to Colchester via the towns in East 
Hartfordshire


Would become:

  C**ABCDE**BC*B***I*H**E*FG

The original phrase list is processed similarly to give:

  ABCDE
  FG
  H
  I

Searching the transformed source text using your algorithm with the list 
of transformed phrases would give the correct set of found phrases as 
required by the original problem.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode

Yup: indeed: fairly coarse.

However, see my next posting re "Ruyton of the Eleven Towns"

that should make some folk feel that they need a set of sewing needles 
rather than "just" a silver teaspoon.


Richmond.

On 1/9/2018 1:45 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 12:35, Richmond Mathewson via use-livecode wrote:

That's because you lot tend to use a silver teaspoon while I tend to
use a great big shovel:

https://www.dropbox.com/s/00t8oftb1ydm8ni/Text%20analyzer%20X.livecode.zip?dl=0 



Heh, great big shovels are great for coarse work - e.g. for the 
problem of finding occurrences of SINGLE WORD towns in the source text 
- as you are in your stack.


However, in this case, that wasn't what was asked for - the problem 
was to find multi-word town names with the constraints that first and 
longest match always wins with no overlap (i.e. as a human would read 
them):


i.e. East Hartford West Palm Beach Colchester Newchester West Chester

With a town list of

   East Hartford
   Hartford West
   West Palm Beach
   Palm Beach
   Chester
   West Chester

Should return:

   East Hartford
   West Palm Beach
   West Chester

Warmest Regards,

Mark.

P.S. The problem is actually exactly the same - in the single-word 
case your alphabet are the characters in the language. In the 
multi-word case, your alphabet is the set of words in all phrases, 
with a 'stop' word.




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode
I can see that the "problem", which my stack does not address, is with 2 
or 3 part place names:


The Rochester/Chester problem is easily dealt with.

While it should be realtively easy to have a subroutine to deal with 
words such as "West" (after all, there are no places just called "West"),
places like a town my parents once lived in called "Haselbury Plucknett" 
would cause problems.


AND, places such as "Ruyton of the Eleven Towns" 
(https://en.wikipedia.org/wiki/Ruyton-XI-Towns)

would really throw a spanner in the works.

Come to think of things . . .

Unless anyone's code can cope with "Ruyton of the Eleven Towns" it won't 
stand up: we could even go further and call

this the "Ruyton of the Eleven Towns Test".

More muffled background noises.

Richmond.

On 1/9/2018 1:29 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 12:05, Richmond Mathewson via use-livecode wrote:

Obviously, when considering names of places such as Colchester,
Rochester and Chester one has
to search for the longer names first and exclude them from later 
searches.


The 'substring' problem (i.e. Chester being 'in' Rochester) isn't 
relevant in the above algorithm because we are 'tokenising' input and 
phrases - essentially changing the alphabet.


i.e. "Rochester Chester Colchester" is turned into ABC, and we match 
A, B or C as atomic units.


I should perhaps point out that the 'processText' operation probably 
needs to be a little better in practice - to at least include a 'stop' 
token for punctuation. For example:


  "The man walked starting from East Hartford, West Hartford could be 
seen in the distance."


In the case where 'Hartford West' and 'Hartford' are the 'known' towns 
(and not 'East Hartford') - the proposed tokenization would result in:


The,man,walked,starting,from,East,Hartford,West,Hartford,could,be,seen,in,the,distance

Which means you'd get "Hartford West" and "Hartford" - when you should 
only get "Hartford" (assuming you care about the linguistic structure 
of the text, at least).


Indeed, the above actually means in preprocessing the text, you can 
actually vastly reduce the number of words to search - any sequences 
of words which aren't in any pharse (or important punctuation) can be 
replaced by "*" say. So the above would become:


  *,East,Hartford,*,West,Hartford,*

The "*" tokens block matching multi-word phrases.

Warmest Regards,

Mark.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Mark Waddingham via use-livecode

On 2018-09-01 12:35, Richmond Mathewson via use-livecode wrote:

That's because you lot tend to use a silver teaspoon while I tend to
use a great big shovel:

https://www.dropbox.com/s/00t8oftb1ydm8ni/Text%20analyzer%20X.livecode.zip?dl=0


Heh, great big shovels are great for coarse work - e.g. for the problem 
of finding occurrences of SINGLE WORD towns in the source text - as you 
are in your stack.


However, in this case, that wasn't what was asked for - the problem was 
to find multi-word town names with the constraints that first and 
longest match always wins with no overlap (i.e. as a human would read 
them):


i.e. East Hartford West Palm Beach Colchester Newchester West Chester

With a town list of

   East Hartford
   Hartford West
   West Palm Beach
   Palm Beach
   Chester
   West Chester

Should return:

   East Hartford
   West Palm Beach
   West Chester

Warmest Regards,

Mark.

P.S. The problem is actually exactly the same - in the single-word case 
your alphabet are the characters in the language. In the multi-word 
case, your alphabet is the set of words in all phrases, with a 'stop' 
word.


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode
That's because you lot tend to use a silver teaspoon while I tend to use 
a great big shovel:


https://www.dropbox.com/s/00t8oftb1ydm8ni/Text%20analyzer%20X.livecode.zip?dl=0

Richmond.

On 1/9/2018 1:29 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 12:05, Richmond Mathewson via use-livecode wrote:

Obviously, when considering names of places such as Colchester,
Rochester and Chester one has
to search for the longer names first and exclude them from later 
searches.


The 'substring' problem (i.e. Chester being 'in' Rochester) isn't 
relevant in the above algorithm because we are 'tokenising' input and 
phrases - essentially changing the alphabet.


i.e. "Rochester Chester Colchester" is turned into ABC, and we match 
A, B or C as atomic units.


I should perhaps point out that the 'processText' operation probably 
needs to be a little better in practice - to at least include a 'stop' 
token for punctuation. For example:


  "The man walked starting from East Hartford, West Hartford could be 
seen in the distance."


In the case where 'Hartford West' and 'Hartford' are the 'known' towns 
(and not 'East Hartford') - the proposed tokenization would result in:


The,man,walked,starting,from,East,Hartford,West,Hartford,could,be,seen,in,the,distance

Which means you'd get "Hartford West" and "Hartford" - when you should 
only get "Hartford" (assuming you care about the linguistic structure 
of the text, at least).


Indeed, the above actually means in preprocessing the text, you can 
actually vastly reduce the number of words to search - any sequences 
of words which aren't in any pharse (or important punctuation) can be 
replaced by "*" say. So the above would become:


  *,East,Hartford,*,West,Hartford,*

The "*" tokens block matching multi-word phrases.

Warmest Regards,

Mark.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Mark Waddingham via use-livecode

On 2018-09-01 12:05, Richmond Mathewson via use-livecode wrote:

Obviously, when considering names of places such as Colchester,
Rochester and Chester one has
to search for the longer names first and exclude them from later 
searches.


The 'substring' problem (i.e. Chester being 'in' Rochester) isn't 
relevant in the above algorithm because we are 'tokenising' input and 
phrases - essentially changing the alphabet.


i.e. "Rochester Chester Colchester" is turned into ABC, and we match A, 
B or C as atomic units.


I should perhaps point out that the 'processText' operation probably 
needs to be a little better in practice - to at least include a 'stop' 
token for punctuation. For example:


  "The man walked starting from East Hartford, West Hartford could be 
seen in the distance."


In the case where 'Hartford West' and 'Hartford' are the 'known' towns 
(and not 'East Hartford') - the proposed tokenization would result in:


   
The,man,walked,starting,from,East,Hartford,West,Hartford,could,be,seen,in,the,distance


Which means you'd get "Hartford West" and "Hartford" - when you should 
only get "Hartford" (assuming you care about the linguistic structure of 
the text, at least).


Indeed, the above actually means in preprocessing the text, you can 
actually vastly reduce the number of words to search - any sequences of 
words which aren't in any pharse (or important punctuation) can be 
replaced by "*" say. So the above would become:


  *,East,Hartford,*,West,Hartford,*

The "*" tokens block matching multi-word phrases.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Richmond Mathewson via use-livecode
Obviously, when considering names of places such as Colchester, 
Rochester and Chester one has

to search for the longer names first and exclude them from later searches.

Richmond.

On 1/9/2018 12:59 pm, Mark Waddingham via use-livecode wrote:

On 2018-09-01 06:48, Stephen MacLean via use-livecode wrote:

Hi All,

First, followed Keith Clarke’s thread and got a lot out of it, thank
you all. That’s gone into my code snippets!

Now I know, the title is not technically true, if it’s 2 words, they
are distinct and different. Maybe it’s because I’ve been banging my
head against this and some other things too long and need to step
back, but I’m having issues getting this all to work reliably.

I’m searching for town names in various text from a list of towns .
Most names are one word, easy to find and count. Some names are 2 or 3
words, like East Hartford or West Palm Beach. Those go against
distinct towns like Hartford and Palm Beach. Others have their names
inside of other town names like Colchester and Chester.


So the problem you are trying to solve sounds like this:

Given a source text TEXT, and a list of multi-word phrases PHRASES, 
find the longest elements of PHRASES which occur in TEXT when reading 
from left to right.


One way to do this is to preprocess the source TEXT and PHRASES, and 
then iterate over it with back-tracking attempting to match each 
phrase in the list.


Preprocessing can be done like this:

  // pText is arbitrary language text, where it presumed 'trueWord' 
will extract

  // the words we can match against those in PHRASES
  command preprocessText pText, @rWords
local tWords
repeat for each trueWord tWord in pText
  -- normalize word variants - e.g. turn Chester's into Chester
  if tWord ends with "'s" then
put char 1 to -3 of tWord into tWord
  else if ... then
...
  else if ... then
...
  end if
  put tWord into tWords[the number of elements in tWords + 1]
end repeat
put tWords into rWords
  end preprocessText

This gives a sequence of words, in order - where word variants have 
been normalized to the 'root' word (the general operation here is 
called 'stemming' - in your case as you are dealing with fragments of 
proper nouns - 's / s suffixes are probably good enough).


The processing for PHRASES is needed to ensure that they all follow a 
consistent form:


  // pPhrases is presumed to be a return-delimited list of phrases
  command preprocessPhrases pPhrases, @rPhrases
-- We accumulate phrases as the keys of tPhrasesA to eliminate 
duplicates

local tPhrasesA
put empty into tPhrasesA

local tPhrases
repeat for each line tPhrase in pPhrases
  local tPhrase
  put empty into tPhrase
  repeat for each trueWord tWord in tPhrase
put tWord & space after tPhrase
  end repeat
  delete the last char of tPhrase
  put true into tPhrasesA[tPhrase]
end repeat

put the keys of tPhrasesA into rPhrases
  end preprocessPhrases

This produces a return-delimited list of phrases, where the individual 
words in each phrase are separated by a *single* space with all 
punctuation stripped, and no phrase appears twice.


With this pre-processing (not the PHRASES pre-processing only needs to 
be done once for any set of PHRASES to match). A naive search 
algorithm would be:


  // pText should be a sequence array of words to search (we use an 
array here because we need fast random access)
  // pPhrases should be a line delimited string-list of multi-word 
phrases to find

  // rMatches will be a string-list of phrases which have been found
  command searchTextForPhrases pText, pPhrases, @rMatches
local tMatchesA
put empty into tMatchesA

-- Our phrases are single-space delimited, so set the item delimiter
set the itemDelimiter to space

-- Loop through pText, by default we bump tIndex by one each time
-- however, if a match is found, then we can skip the words 
constituting

-- the matched phrase.
local tIndex
put 1 into tIndex
repeat until pText[tIndex] is empty
  -- Store the current longest match we have found starting at tIndex
  local tCurrentMatch
  put empty into tCurrentMatch

  -- Check each phrase in turn for a match.
  repeat for each line tPhrase in pPhrases
-- Assume a match succeeds until it doesn't
local tPhraseMatched
put true into tPhraseMatched

-- Iterate through the items (words) in each phrase, if the 
sequence of
-- words in the phrase is not the same as the sequence of 
words in the text
-- starting at tIndex, then tPhraseMatched will be false on 
exit of the loop.

local tSubIndex
put tIndex into tSubIndex
repeat for each item tWord in tPhrase
  -- Failure to match the word at tSubIndex is failure to 
match the phrase

  if pText[tSubIndex] is not tWord then
put false into tPhraseMatched

Re: Searching for a word when it's more than one word

2018-09-01 Thread Mark Waddingham via use-livecode

On 2018-09-01 06:48, Stephen MacLean via use-livecode wrote:

Hi All,

First, followed Keith Clarke’s thread and got a lot out of it, thank
you all. That’s gone into my code snippets!

Now I know, the title is not technically true, if it’s 2 words, they
are distinct and different. Maybe it’s because I’ve been banging my
head against this and some other things too long and need to step
back, but I’m having issues getting this all to work reliably.

I’m searching for town names in various text from a list of towns .
Most names are one word, easy to find and count. Some names are 2 or 3
words, like East Hartford or West Palm Beach. Those go against
distinct towns like Hartford and Palm Beach. Others have their names
inside of other town names like Colchester and Chester.


So the problem you are trying to solve sounds like this:

Given a source text TEXT, and a list of multi-word phrases PHRASES, find 
the longest elements of PHRASES which occur in TEXT when reading from 
left to right.


One way to do this is to preprocess the source TEXT and PHRASES, and 
then iterate over it with back-tracking attempting to match each phrase 
in the list.


Preprocessing can be done like this:

  // pText is arbitrary language text, where it presumed 'trueWord' will 
extract

  // the words we can match against those in PHRASES
  command preprocessText pText, @rWords
local tWords
repeat for each trueWord tWord in pText
  -- normalize word variants - e.g. turn Chester's into Chester
  if tWord ends with "'s" then
put char 1 to -3 of tWord into tWord
  else if ... then
...
  else if ... then
...
  end if
  put tWord into tWords[the number of elements in tWords + 1]
end repeat
put tWords into rWords
  end preprocessText

This gives a sequence of words, in order - where word variants have been 
normalized to the 'root' word (the general operation here is called 
'stemming' - in your case as you are dealing with fragments of proper 
nouns - 's / s suffixes are probably good enough).


The processing for PHRASES is needed to ensure that they all follow a 
consistent form:


  // pPhrases is presumed to be a return-delimited list of phrases
  command preprocessPhrases pPhrases, @rPhrases
-- We accumulate phrases as the keys of tPhrasesA to eliminate 
duplicates

local tPhrasesA
put empty into tPhrasesA

local tPhrases
repeat for each line tPhrase in pPhrases
  local tPhrase
  put empty into tPhrase
  repeat for each trueWord tWord in tPhrase
put tWord & space after tPhrase
  end repeat
  delete the last char of tPhrase
  put true into tPhrasesA[tPhrase]
end repeat

put the keys of tPhrasesA into rPhrases
  end preprocessPhrases

This produces a return-delimited list of phrases, where the individual 
words in each phrase are separated by a *single* space with all 
punctuation stripped, and no phrase appears twice.


With this pre-processing (not the PHRASES pre-processing only needs to 
be done once for any set of PHRASES to match). A naive search algorithm 
would be:


  // pText should be a sequence array of words to search (we use an 
array here because we need fast random access)
  // pPhrases should be a line delimited string-list of multi-word 
phrases to find

  // rMatches will be a string-list of phrases which have been found
  command searchTextForPhrases pText, pPhrases, @rMatches
local tMatchesA
put empty into tMatchesA

-- Our phrases are single-space delimited, so set the item delimiter
set the itemDelimiter to space

-- Loop through pText, by default we bump tIndex by one each time
-- however, if a match is found, then we can skip the words 
constituting

-- the matched phrase.
local tIndex
put 1 into tIndex
repeat until pText[tIndex] is empty
  -- Store the current longest match we have found starting at 
tIndex

  local tCurrentMatch
  put empty into tCurrentMatch

  -- Check each phrase in turn for a match.
  repeat for each line tPhrase in pPhrases
-- Assume a match succeeds until it doesn't
local tPhraseMatched
put true into tPhraseMatched

-- Iterate through the items (words) in each phrase, if the 
sequence of
-- words in the phrase is not the same as the sequence of words 
in the text
-- starting at tIndex, then tPhraseMatched will be false on exit 
of the loop.

local tSubIndex
put tIndex into tSubIndex
repeat for each item tWord in tPhrase
  -- Failure to match the word at tSubIndex is failure to match 
the phrase

  if pText[tSubIndex] is not tWord then
put false into tPhraseMatched
exit repeat
  end if

  -- The current word of the phrase matches, so move to the 
nbext

  add 1 to tSubIndex
end repeat

-- We are only interested in the longest match at any point, so 
only up

Re: Deleting a char inside a textField via code

2018-09-01 Thread Richmond Mathewson via use-livecode

Not much help forthcoming around these parts: so: Diddit masen:

*on mouseUp**
**   put the selectedChunk into CHK**
**   put word 4 of CHK into NUMERO**
**   delete char NUMERO of fld "ff"**
**end mouseUp*

muffled rude noises.

Richmond.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Deleting a char inside a textField via code

2018-09-01 Thread Richmond Mathewson via use-livecode

What is unfortunate is that these "possibilities" are not possible:

delete before the selectedText

delete after the selectedText

and THIS works ONLY when some text is selected (rather than before the 
insertion point):


delete the selectedText

there seems to be no obvious way to work out what the character before 
the insertion point is.


While it is perfectly possible to do something like this:

select before char 15 of fld "myText"

it does not seem possible to do something like this:

put the selected  and get "before char 15"

What I am looking for (just in case it seems obscure) is how
to delete the char just before the insertion point without having to 
touch the delete key

on my keyboard.

Richmond.

On 31/8/2018 9:30 pm, Paul Dupuis via use-livecode wrote:

If you want to delete the last characters by script, why not something like:

delete last char of fld X

Or a more complex version might be

put the selectedChunk into tWhere
put word 2 of tWhere into tStart -- staring char position of the cursor
put word 4 of tWhere into tEnd -- ending char position of the cursor
if tStart > tEnd then -- just an insertion point
   delete char tEnd of field X -- delete the character just before the
insertion point
else -- some field content is selected, so
   delete char tStart to tEnd of fld X -- delete the selected field content
end if

I did this from memory, so check the dictionary for the exact
expressions returned by the selectedChunk function.,

On 8/31/2018 1:57 PM, Richmond Mathewson via use-livecode wrote:

Digging further . . .

I found out that the problem appearas:

1. NOT to be with LiveCode.

2. NOT to be with MacOS.

Because using a font other than my one works well.

So?

What hidden aspects of my Devawriter.ttf font are gumming up the works?

Richmond.

On 31/8/2018 6:44 pm, Richmond Mathewson wrote:

Normally, if one were typing into a textField and made a mistake one
would hit the back delete key
and the mistake would vanish.

How does one do this "programmatically"?

Here's the (admittedly odd scenario):

Unicode behaves inconsistently in various marginal cases with
Devanagari script,
and what happens is that the first time one sends this:

put numToCodePoint(7418) after the selectedText

one ends up with a useless square.

But if one does this:

put numToCodePoint(7418) after the selectedText
put numToCodePoint(7418) after the selectedText

one ends up with the useless square PRECEDED by the target glyph.

So, the 'clever' work around might be to do this:

put numToCodePoint(7418) after the selectedText
put numToCodePoint(7418) after the selectedText

followed by deleting the useless square

However doing this:

put numToCodePoint(65288) after the selectedText

results in another useless square.

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Searching for a word when it's more than one word

2018-09-01 Thread Keith Clarke via use-livecode
Very interesting Steve, your use case is actually very close to what I’m trying 
to achieve, which is to identify keywords and phrases within a corpus of text - 
think prioritised ’tag cloud’ metadata.

My original plan (as a non-programmer) was to identify the most popular unique 
words within the corpus and then go back in to find the words either side and 
check their popularity, etc.

However, from what I’ve learned here, my current pseudo-logic is:

1. Parse the whole source into 1, 2, 3 and 4 trueWord chunks (ideally in one 
pass but I’m still struggling with my array learning curve, so probably via 
lists & fields so I can see my workings)  
2. Remove lines containing noise words and any punctuation that would, by 
definition terminate the keyword/phrase
3. Count & deduplicate the remaining lines
4. Sense-check against a ‘current keywords’ list (which appears to resonate 
with your town names problem?) 

From the unique words results I’ve found, I also note issues around 
singular/plural, synonyms, alternative spelling, etc. - which speak to ‘fuzzy 
logic’ or dare one mention NLP (as inNatural Language Processing) capabilities. 

I wonder if anyone has experimented with LiveCode accessing / using any 
libraries for this kind of language processing - probably another Pandora’s box 
containing infinity + 1 cans of worms! :-)  

Back to basics, I’ll share my workings as I blunder forward and would welcome 
any insights the community experts have to offer.
Best,
Keith 

> On 1 Sep 2018, at 05:48, Stephen MacLean via use-livecode 
>  wrote:
> 
> Hi All,
> 
> First, followed Keith Clarke’s thread and got a lot out of it, thank you all. 
> That’s gone into my code snippets!
> 
> Now I know, the title is not technically true, if it’s 2 words, they are 
> distinct and different. Maybe it’s because I’ve been banging my head against 
> this and some other things too long and need to step back, but I’m having 
> issues getting this all to work reliably.
> 
> I’m searching for town names in various text from a list of towns . Most 
> names are one word, easy to find and count. Some names are 2 or 3 words, like 
> East Hartford or West Palm Beach. Those go against distinct towns like 
> Hartford and Palm Beach. Others have their names inside of other town names 
> like Colchester and Chester.
> 
> "is among the words of” or "is among the trueWords of” works great to find 
> single words, but only works on single words and doesn’t consider “Chester’s” 
> to be ”Chester”, it isn't.
> 
> “is in” works great for finding multiple words like “East Hartford” and "West 
> Palm Beach", finds “Chester” in “Chester’s” but also finds “chester” in 
> “Colchester”.
> 
> At this point, I’ve been using different methods for single word towns vs 
> multi-word towns and while generally effective, trying to accommodate for 
> these and other oddities has made it a complete mess of code.
> 
> If someone has done something similar, or can point me in the right 
> direction, it would be greatly appreciated.
> 
> TIA,
> 
> Steve MacLean
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode