Re: is among the words AND find words

2011-12-22 Thread Bob Sneidar
Drat, I had a function that did this very thing, but I replaced it with the dbschema_getTable() function in sqlYoga which returns everything you would want to know about a table schema. I was not aware that the CREATE TABLE command worked with sqLite. Bob On Dec 22, 2011, at 9:34 AM, Pete w

Re: is among the words AND find words

2011-12-22 Thread Pete
Yes, I know about that but the project I'm working on requires me to parse out all the individual elements of the CREATE statement, not actually create the table. The PRAGMA commands provide some information about the table but you have to parse the CREATE command to get the rest. On Thu, Dec 22,

Re: is among the words AND find words

2011-12-22 Thread Bob Sneidar
On Dec 22, 2011, at 7:17 AM, Jim Hurley wrote: > Dave, > > Ah! Those mighty regular expressions. Sm day I'll have to study up on > them. DO YOU VALUE YOUR SANITY??? DON'T DO IT ___ use-livecode mailing list use-livecode@lists.runrev.com Pleas

Re: is among the words AND find words

2011-12-22 Thread Bob Sneidar
Open the sqLite_master table. In it you will find a column called SQL with entries for how to create each table. Bob On Dec 21, 2011, at 2:08 PM, Pete wrote: > I think I tried that but the arguments aren't always comma delimited > unfortunately. Somewhat related,I wish SQLite provided more f

Re: is among the words AND find words

2011-12-22 Thread Jim Hurley
Dave, Ah! Those mighty regular expressions. Sm day I'll have to study up on them. Yes that works very nicely. The other method (one that I understand ;) ) now boils down to this: on mouseUp put field 1 into tText put containsWord("time", tText) end mouseUp function containsWord tWor

Re: is among the words AND find words

2011-12-22 Thread Jim Hurley
Very good Hugh. This adds another level of versatility, first by the addition of a "rule" and then by returning a word count. You are right about what constitutes a word. That is what is nice about having a "rule". BTW: The previous "token" method can be changed into a count by replacing this

Re: is among the words AND find words

2011-12-22 Thread Dave Cragg
Late to the thread. If the purpose is just to see whether the word exists in a string, would this work (using regular expressions)? on mouseUp put "Some timely text with time, and more." into tString put "time" into tTarget put containsWord(tTarget, tString) end mouseUp function conta

Re: is among the words AND find words

2011-12-22 Thread FlexibleLearning
Aha. So we are now only testing 'exist', and not the word number? Since I've already written this, I'll post it anyway... The problem (as always when this topic is raised) is the definition of a 'word', as indicated by the additional inclusion of 'token' in the language, and thus the definition of

Re: is among the words AND find words

2011-12-21 Thread Jim Hurley
Strike most of my last message. It appears that most of the function can be replaced with an examination of the entire text (dah) as in: put tWord is among the tokens of tList into tTest return tTest This tests the whole text; it is not necessary to test each string containing the wor

Re: is among the words AND find words

2011-12-21 Thread Jim Hurley
Thanks to all for their help with this. I learned a new key word in "token". So far the function below handles everything reasonable I have thrown at it, including finding "time" in the less than reasonable text in field 1: "Now is timely the timeless time.-for, all good." on mouseUp pu

Re: is among the words AND find words

2011-12-21 Thread Bob Sneidar
True enough, except that a comma *might* be there under normal circumstances, whereas I cannot think of an example where two words can be joined by a comma in normal English grammar. But again, it might not be english grammar we are trying to work with, so any function devised could not be so ge

Re: is among the words AND find words

2011-12-21 Thread Pete
I think I tried that but the arguments aren't always comma delimited unfortunately. Somewhat related,I wish SQLite provided more formatted access to the table structures. Some stuff is available via the PRAGMA statements but for other information, there's no alternative but to parse the CREATE TA

Re: is among the words AND find words

2011-12-21 Thread Mark Wieder
Bob- Wednesday, December 21, 2011, 12:54:46 PM, you wrote: > I suppose it could be argued that everything would break down if > the text were "now,is,the,time,for,all,goo,men..." but at some point > we have to presume the absence of the absurd? to have 2 words split > by a comma is a problem with

Re: is among the words AND find words

2011-12-21 Thread Bob Sneidar
OIC good point. But wouldn't it be better simply isolate the comma delimited arguments (usually in parens) in an SQL statement and then deal with them as items? But I suppose there are all kinds of special circumstances that would make a general purpose word function very unwieldy. Bob On Dec

Re: is among the words AND find words

2011-12-21 Thread Pete
Not really - try parsing out an SQL SELECT statement. Granted that's not really English text but if you want to make this a general purpose function, you have to deal with that circumstance. I needed to do that and ended up going through the text and inserting a space after each comma if there wa

Re: is among the words AND find words

2011-12-21 Thread Bob Sneidar
I suppose it could be argued that everything would break down if the text were "now,is,the,time,for,all,goo,men..." but at some point we have to presume the absence of the absurd? to have 2 words split by a comma is a problem with the data, not with the software. Bob On Dec 21, 2011, at 12:0

Re: is among the words AND find words

2011-12-21 Thread Bob Sneidar
On Dec 21, 2011, at 12:28 PM, Jim Hurley wrote: > where I just replace the quote with a carrot or whatever You must mean caret? ;-) Otherwise I think you just found an algorithm that could solve the problem of world hunger! Bob ___ use-livecode m

Re: is among the words AND find words

2011-12-21 Thread Pete
Plus it doesn't work for the case where the sentence ends with a period and you search for "men" - that returns zero. On Wed, Dec 21, 2011 at 12:09 PM, Mark Wieder wrote: > FlexibleLearning- > > Wednesday, December 21, 2011, 12:00:29 PM, you wrote: > > > An alternative approach: > > > Assuming t

Re: is among the words AND find words

2011-12-21 Thread Jim Hurley
Thanks, Hugh. Unfortunately there are a couple of problems. It won't work for this line: Now is the time. because of the period. Nor for the line "Now is the time for all" because of the quotes. Stripping the lead and trailing characters is cumbersome, but fairly reliable--except for

Re: is among the words AND find words

2011-12-21 Thread Mark Wieder
FlexibleLearning- Wednesday, December 21, 2011, 12:00:29 PM, you wrote: > An alternative approach: > Assuming that the phrase "now is the time, for all good men" is in fld 1, > then this button script > on mouseUp > put findWord(fld 1,"time") > end mouseUp > function findWord pContent,pS

Re: is among the words AND find words

2011-12-21 Thread FlexibleLearning
An alternative approach: Assuming that the phrase "now is the time, for all good men" is in fld 1, then this button script on mouseUp put findWord(fld 1,"time") end mouseUp function findWord pContent,pStr if pStr is among the tokens of pContent then return num of words of char 1 to o

Re: is among the words AND find words

2011-12-21 Thread Jim Hurley
Bob et. al. > > Message: 14 > Date: Wed, 21 Dec 2011 08:24:59 -0800 > From: Bob Sneidar > To: How to use LiveCode > Subject: Re: is among the words AND find words > Message-ID: > Content-Type: text/plain; charset=us-ascii > > I think this underscores the ne

Re: is among the words AND find words

2011-12-21 Thread Bernard Devlin
Before rushing for a tokenOffset feature request, perhaps it might be worth considering some other options. Perhaps there could be a way of signalling a string of items which would mark either what should be considered a non-word, or a non-token. That way such a search feature could be used with

Re: is among the words AND find words

2011-12-21 Thread Bob Sneidar
Feature request! Sign me up! Bob On Dec 21, 2011, at 10:12 AM, Pete wrote: > The token keyword works with "time," and "time-bomb" (assuming you want to > find just "time"). I've found it to be really useful in a number of > circumstances in parsing out chunks of text from strings that don't fit

Re: is among the words AND find words

2011-12-21 Thread Pete
The token keyword works with "time," and "time-bomb" (assuming you want to find just "time"). I've found it to be really useful in a number of circumstances in parsing out chunks of text from strings that don't fit the standard word model - like SQL statements which can include commas, parentheses

Re: is among the words AND find words

2011-12-21 Thread Bob Sneidar
I think this underscores the need for the words keyword to be upgraded to reflect real text. For instance, word delimiters could be a property containing all the characters which might be word delimiters, all the punctuations for example. I don't know how you would treat a hyphen. Upon thinkin

Re: is among the words AND find words

2011-12-21 Thread Alex Tweedly
Hmmm ... what will happen to "there is time,enough for it" - NB no space before or after the comma. I think you *want* to find "time" in that case - but I'm not sure if you will by stripping out all non-letter characters from the word "time,enough". Would it not be simpler (and faster) to fin

Re: is among the words AND find words

2011-12-21 Thread Phil Davis
No worries Pete! Phil On 12/21/11 12:09 AM, Pete wrote: Whoops, sorry Phil, replied before I saw your post. On Tue, Dec 20, 2011 at 9:41 PM, Phil Davis wrote: Hi Jim, Try "token" instead of "word" as the chunk you're looking for. It will work. On 12/20/11 4:42 PM, Jim Hurley wrote: If

Re: is among the words AND find words

2011-12-21 Thread Pete
Whoops, sorry Phil, replied before I saw your post. On Tue, Dec 20, 2011 at 9:41 PM, Phil Davis wrote: > Hi Jim, > > Try "token" instead of "word" as the chunk you're looking for. It will > work. > > > On 12/20/11 4:42 PM, Jim Hurley wrote: > >> If the sentence: >> >> "Now is the time, for all

Re: is among the words AND find words

2011-12-20 Thread Pete
I need is > > > > put wordOffset("time", "Now is the time, for all good men.") > > > > to show 4 when wholeMatches is true > > > > It appears that there is no way in LiveCode to find whole words in a > variable reliably. > >

Re: is among the words AND find words

2011-12-20 Thread Phil Davis
Hi Jim, Try "token" instead of "word" as the chunk you're looking for. It will work. On 12/20/11 4:42 PM, Jim Hurley wrote: If the sentence: "Now is the time, for all good men." is within the field "myField" , then find word "time" in field "myField" is successful. The word "time" is

Re: is among the words AND find words

2011-12-20 Thread Jim Hurley
ue > > It appears that there is no way in LiveCode to find whole words in a variable > reliably. > > Wish there were. > > Jim Hurley > > > >> From: Bob Sneidar >> To: How to use LiveCode >> Subject: Re: is among the words AND find words >&g

Re: is among the words AND find words

2011-12-20 Thread Jim Hurley
iveCode to find whole words in a variable reliably. Wish there were. Jim Hurley > From: Bob Sneidar > To: How to use LiveCode > Subject: Re: is among the words AND find words > Message-ID: > Content-Type: text/plain; charset=us-ascii > > Not sure if wholeMatches af

Re: is among the words AND find words

2011-12-20 Thread Bob Sneidar
Not sure if wholeMatches affects the find command, but if you set wholeMatches to true and then use wordOffset("time",field "myField") then I think you will get the results you are looking for. wordOffset() returns 0 when it fails to find a match. Bob On Dec 20, 2011, at 4:42 PM, Jim Hurley

is among the words AND find words

2011-12-20 Thread Jim Hurley
If the sentence: "Now is the time, for all good men." is within the field "myField" , then find word "time" in field "myField" is successful. The word "time" is found despite the fact that it is not delimited with spaces on either side. But "time" is among the words of "Now is the t