New chunks

Jim Hurley jhurley0305 at sbcglobal.net
Sat Mar 15 19:05:58 EDT 2014


> 
> Message: 3
> Date: Sat, 15 Mar 2014 11:30:06 -0400
> From: "Peter M. Brigham" <pmbrig at gmail.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Re: New chunks
> Message-ID: <D04520E3-36DF-4BF6-9CED-72B363E19566 at gmail.com>
> Content-Type: text/plain; charset=windows-1252
> 
> On Mar 13, 2014, at 11:51 AM, Jim Hurley wrote:
> 
>> I have a poor man?s version that is workable.
>> 
>> However just ran across a sentence in today?s NYT that I will have to include:
>> 
>>      (?What they?re offering people is a full stomach and an empty soul.?)
>> 
>> I had dealt with the quote beyond the period and the paren beyond the period, but not both.
> 
> Here's a simple function I've been using. The new LC grammar revisions will make it obsolete eventually.
> 
> function naturalWord tWord
>  -- strips punctuation from HC-style "words" fore and aft
>  -- to return something closer to what is normally understood as a word
>  put "abcdefghijklmnopqrstuvwxyz1234567890" into tAlphabet
>  -- numerals included to cope with numbers and things like "HTML5"
>  repeat while char 1 of tWord is not in tAlphabet
>     delete char 1 of tWord
>  end repeat
>  repeat while char -1 of tWord is not in tAlphabet
>     delete char -1 of tWord
>  end repeat
>  return tWord
> end naturalWord
> 
> It's simple, and therefore somewhat simple-minded -- it will miss some cases, but I've found it useful.
> 
> "Every complicated problem has a simple, easy, obvious, wrong answer."
>               -- H. L. Mencken
> 
> -- Peter
> 
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig

Hi Peter,

Always good to hear from you. I like your approach, but as you say, it  sill miss some cases, for example: “Don’t’ tell Ms. Fitz-Williams that pi is equal to 3.15”

I have built an app I find very useful. I do a lot of writing and I often want to go back to search through a manuscripts for sentences or paragraphs contain a certain combination of words, in whatever order. 

The following app allows one to put any text into a field and search for any or all words (whole words of patricidal)  in a sentence or paragraph in whatever order, even MS Word with all their curly quotes and apostrophes etc. It handles decimal numberers and also check for 70 of the most common abbreviations. But still I am looking forward to LC implementation of these new word and sentence chunks. No telling how many special cases I have missed.

In the msg. box:

  go url “https://dl.dropboxusercontent.com/u/47044230/Find%20sentences2.livecode”

Warm regards,

Jim






More information about the use-livecode mailing list