Re: Word chunk includes punctuation
Message: 27 Date: Tue, 14 Aug 2012 14:41:48 -0500 From: J. Landman Gay jac...@hyperactivesw.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Word chunk includes punctuation Message-ID: 502aa9fc.3000...@hyperactivesw.com Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 8/14/12 12:47 AM, Scott Morrow wrote: Mark, not even a token effort? -- Scott Morrow On Aug 13, 2012, at 9:41 PM, Mark Wieder wrote: Jim- Monday, August 13, 2012, 5:31:07 PM, you wrote: So, how many words could a word chunk chunk, if a word chunk could chunk words? groan. all right... I'm annoyed that I didn't think of it first... All right. Jim, Scott, go sit in the corner with Colin. Mark can just think about sitting in the corner. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com Augh mom! We were just have'n fun. Jim ___ 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: Word chunk includes punctuation
I haven't really followed this issue, but that has never stopped me in the past. Just diving in I tried:put the number of words in tText into msg box No matter what I put into tText by way of quotes or tabs or punctuation, I always seem to get what I expect. It would be nice if someone would post a line or two of text, the quintessential challenge, to demonstrate where the problems lie. Jim Hurley ___ 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: Word chunk includes punctuation
On Aug 15, 2012, at 7:23 AM, Jim Hurley wrote: Just diving in I tried:put the number of words in tText into msg box No matter what I put into tText by way of quotes or tabs or punctuation, I always seem to get what I expect. It would be nice if someone would post a line or two of text, the quintessential challenge, to demonstrate where the problems lie. If I put the following into a field: How many words are in this field? and then try put the number of words of fld f I get 3 That is not what *I* would expect. There was a discussion last year on this list of the pros and cons of maintaining the HC convention of regarding anything in quotes as a single word. I still don't think it makes sense. In my universe the answer is 7. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ 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: Word chunk includes punctuation
Peter M. Brigham wrote: If I put the following into a field: How many words are in this field? and then try put the number of words of fld f I get 3 That is not what *I* would expect. There was a discussion last year on this list of the pros and cons of maintaining the HC convention of regarding anything in quotes as a single word. I still don't think it makes sense. In my universe the answer is 7. But your universe wasn't designed by Apple, and Apple's universe has a dent in it. ;) There are more than a few oddities the HyperTalk designers implemented, and when the MetaCard engine was born in '92 it made good sense to support them. 20 years later the relevance of HT compatibility may be dismissible, but now that we have 20 years of MetaTalk/Transcript/RevTalk/LiveCode lying around, it wouldn't be realistic to expect that to change. For myself, when I need an actual word count and run up against quotes, I just do this before getting the number of words: replace quote with space in tMyText If LiveCode is lucky enough to be around in another 20 years we can expect that many more users to have shaken their heads in disbelief that this is necessary. But most if not all languages have some gotchas which are accidents of its history, and LiveCode is no exception. So as with any other language: we try something, it doesn't work as expected, we learn how to deal with it, add a line of code, and move on. Maybe somewhere down the road we can see LiveCode2, an optional which could be activated with a flip of a global property to make for a more sensible set of syntax for the sanity of newcomers. In the meantime we are where we are, and warts and all it's not a bad place to be. -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com Follow me on Twitter: http://twitter.com/FourthWorldSys ___ 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: Word chunk includes punctuation
On Aug 15, 2012, at 8:24 AM, Richard Gaskin wrote: Peter M. Brigham wrote: If I put the following into a field: How many words are in this field? and then try put the number of words of fld f I get 3 That is not what *I* would expect. There was a discussion last year on this list of the pros and cons of maintaining the HC convention of regarding anything in quotes as a single word. I still don't think it makes sense. In my universe the answer is 7. But your universe wasn't designed by Apple, and Apple's universe has a dent in it. ;) There are more than a few oddities the HyperTalk designers implemented, and when the MetaCard engine was born in '92 it made good sense to support them. 20 years later the relevance of HT compatibility may be dismissible, but now that we have 20 years of MetaTalk/Transcript/RevTalk/LiveCode lying around, it wouldn't be realistic to expect that to change. For myself, when I need an actual word count and run up against quotes, I just do this before getting the number of words: replace quote with space in tMyText If LiveCode is lucky enough to be around in another 20 years we can expect that many more users to have shaken their heads in disbelief that this is necessary. But most if not all languages have some gotchas which are accidents of its history, and LiveCode is no exception. So as with any other language: we try something, it doesn't work as expected, we learn how to deal with it, add a line of code, and move on. Maybe somewhere down the road we can see LiveCode2, an optional which could be activated with a flip of a global property to make for a more sensible set of syntax for the sanity of newcomers. In the meantime we are where we are, and warts and all it's not a bad place to be. Oh, I agree with that wholeheartedly. In the scheme of things it's a minor complaint. My griping does not negate the fact that I love so much about LC overall. And it's possible to work around a lot of these gotchas given the versatility of the language. That's why God made utility libraries! -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ 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: Word chunk includes punctuation
I don't expect anything I author to actually work! And yet sometimes it does. I suppose it all balances out. ;-) On Aug 15, 2012, at 7:33 AM, Peter M. Brigham wrote: If I put the following into a field: How many words are in this field? and then try put the number of words of fld f I get 3 That is not what *I* would expect. There was a discussion last year on this list of the pros and cons of maintaining the HC convention of regarding anything in quotes as a single word. I still don't think it makes sense. In my universe the answer is 7. -- Peter ___ 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: Word chunk includes punctuation
HAR! Bob On Aug 13, 2012, at 5:31 PM, Jim Hurley wrote: So, how many words could a word chunk chunk, if a word chunk could chunk words? Jim ___ 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: Word chunk includes punctuation
From the dictionary: 1. Each of the following characters is a token: =, +, -, *, /, [, ], (, ), {, }, , , and comma (,). 2. Each of the following characters is a token delimiter: ; (semicolon), space, return, and tab. So no, a question mark is NOT a delimiter. In this the dictionary speaks true. Bob On Aug 14, 2012, at 8:37 AM, Peter M. Brigham wrote: On Aug 13, 2012, at 2:20 PM, Paul Dupuis wrote: The documentation also doesn't mention that ? works as a token per Mark's post, so perhaps my caution is unwarranted. Hmmm. For me, put token 1 of (test1?test2) gives test1?test2 so questionmark does not seem to be either a token or a tokendelimiter. 2008 MacBook, OSX 10.7.4 (Lion), Rev Studio 4.5.3, build 1210 -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ 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: Word chunk includes punctuation
James- Monday, August 13, 2012, 8:10:57 AM, you wrote: If not, has anyone got a workaround that doesn't require me testing for a punctuation character at the end of every word or replacing them all with spaces? Token 1 of word 5 of... -- -Mark Wieder mwie...@ahsoftware.net ___ 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: Word chunk includes punctuation
On Aug 13, 2012, at 11:10 AM, James Hale wrote: Is this a bug? No, it's a 'convention'… it mimics the way that HyperCard recognized a word; as stated in the Dictionary under word: A word is delimited by one or more spaces, tabs, or returns, or enclosed by double quotes. A single word can contain multiple characters and multiple items, but not multiple lines. If not, has anyone got a workaround that doesn't require me testing for a punctuation character at the end of every word or replacing them all with spaces? As Mark pointed out, the use of token helps separate the wheat from the chaff (see the entry on token in the Dictionary for how a token is defined). Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.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: Word chunk includes punctuation
Wait, tab too? Odd since put word one of test1 tab test2 gives me test1 test2 Bob On Aug 13, 2012, at 9:13 AM, Ken Ray wrote: A word is delimited by one or more spaces, tabs, or returns, or enclosed by double quotes. A single word can contain multiple characters and multiple items, but not multiple lines. ___ 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: Word chunk includes punctuation
Bob Sneidar bobs@... writes: Wait, tab too? Odd since put word one of test1 tab test2 gives me test1test2 LOL. Yes, it does. You're asking for (word one of test1) tab test2 -- Mark Wieder mwie...@ahsoftware.net ___ 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: Word chunk includes punctuation
Ahah! So concatenation is not a very high priority when evaluating statements. I learn something new every day! I can see though why it would be like that. I could also ask for: word 1 of one two word 1 of three four and expect one three. One more argument for grouping with parentheses even when it seems unnecessary. Bob On Aug 13, 2012, at 9:51 AM, Mark Wieder wrote: Bob Sneidar bobs@... writes: Wait, tab too? Odd since put word one of test1 tab test2 gives me test1 test2 LOL. Yes, it does. You're asking for (word one of test1) tab test2 -- Mark Wieder mwie...@ahsoftware.net ___ 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: Word chunk includes punctuation
Bob Sneidar wrote: Ahah! So concatenation is not a very high priority when evaluating statements. I learn something new every day! I can see though why it would be like that. I could also ask for: word 1 of one two word 1 of three four and expect one three. One more argument for grouping with parentheses even when it seems unnecessary. Sometimes they're not necessary with compound expressions, but even then they're almost always useful for readability. I tend to use parens liberally for not only string concats but also for multi-conditional expressions, e.g.: if ( (word 1 of tMyVar = Bob) AND (word 2 of tMyVar = Sneidar) ) \ OR (tMyVar = Andre Garzia) then DoSomething end if -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com Follow me on Twitter: http://twitter.com/FourthWorldSys ___ 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: Word chunk includes punctuation
On 8/13/2012 12:13 PM, Ken Ray wrote: On Aug 13, 2012, at 11:10 AM, James Hale wrote: Is this a bug? No, it's a 'convention'… it mimics the way that HyperCard recognized a word; as stated in the Dictionary under word: A word is delimited by one or more spaces, tabs, or returns, or enclosed by double quotes. A single word can contain multiple characters and multiple items, but not multiple lines. If not, has anyone got a workaround that doesn't require me testing for a punctuation character at the end of every word or replacing them all with spaces? As Mark pointed out, the use of token helps separate the wheat from the chaff (see the entry on token in the Dictionary for how a token is defined). One caution: token does not separate . (period), ! (exclamation mark), or ? (question mark). If you are really trying to process English text, you probably will want to write your own punctuation remover as it can then figure the difference between a period at the end of a sentence and a period at the end of abbreviations like Dr. or Mr. -- Paul Dupuis Cofounder Researchware, Inc. http://www.researchware.com/ http://www.twitter.com/researchware http://www.facebook.com/researchware http://www.linkedin.com/company/researchware-inc ___ 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: Word chunk includes punctuation
Paul- Monday, August 13, 2012, 1:32:58 PM, you wrote: One caution: token does not separate . (period), ! (exclamation mark), or ? (question mark). If you are really trying to process English text, you probably will want to write your own punctuation remover as it can then figure the difference between a period at the end of a sentence and a period at the end of abbreviations like Dr. or Mr. Good point. A question mark does count as a word separator, so token 1 of word 1 of... will still work, but the other two could cause problems. -- -Mark Wieder mwie...@ahsoftware.net ___ 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: Word chunk includes punctuation
The documentation also doesn't mention that ? works as a token per Mark's post, so perhaps my caution is unwarranted. Silly me, I believed the documentation! On 8/13/2012 5:01 PM, Bob Sneidar wrote: Hmmm... odd again that put token one of word one of test1! gives me test1 without the exclamation mark. The documentation states: 1. Each of the following characters is a token: =, +, -, *, /, [, ], (, ), {, }, , , and comma (,). The exclamation mark is not one of those (unless I am token blind [again]) and yet it seems that it is being treated as one. This looks very much like an error in documentation. Bob On Aug 13, 2012, at 1:32 PM, Paul Dupuis wrote: One caution: token does not separate . (period), ! (exclamation mark), or ? (question mark). If you are really trying to process English text, you probably will want to write your own punctuation remover as it can then figure the difference between a period at the end of a sentence and a period at the end of abbreviations like Dr. or Mr. ___ 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 -- Paul Dupuis Cofounder Researchware, Inc. http://www.researchware.com/ http://www.twitter.com/researchware http://www.facebook.com/researchware http://www.linkedin.com/company/researchware-inc ___ 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: Word chunk includes punctuation
Seems period is the only common punctuation that is not considered a token. How odd is that?? Bob On Aug 13, 2012, at 2:20 PM, Paul Dupuis wrote: The documentation also doesn't mention that ? works as a token per Mark's post, so perhaps my caution is unwarranted. Silly me, I believed the documentation! ___ 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: Word chunk includes punctuation
On 8/13/12 4:45 PM, Bob Sneidar wrote: Seems period is the only common punctuation that is not considered a token. How odd is that?? Probably to get the right results when the word is a decimal number or a url. -- 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: Word chunk includes punctuation
Paul Dupuis paul@... writes: The documentation also doesn't mention that ? works as a token per Mark's post, so perhaps my caution is unwarranted. You know, I could swear I tried this before posting, and I've still got the commands in my message box history to prove it, but I'm getting different results now. Bob's right - the ! acts as a token. But the ? acts the same as a . in not being either a word or token separator. I'm happy about periods not separating things in the middle of a word, now I need to find a problem that question marks solve. -- Mark Wieder mwie...@ahsoftware.net ___ 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