Nicolas,

When "wholeMatches" is used with wordOffset, itemOffset or lineOffset, there
has to be a match of the *whole chunk*. That is, if you set the wholeMatches
to true and then do a 'lineOffset', the *entire line* must match your search
string.

Here is an approach to solve your problem:

-- Add a tab to the end of each line via script (so it's not stored in the
field), and
-- search for <tab>tWord<tab> using lineOffset, as in:

put field 1 into tField1
replace cr with tab&cr in tField1  -- adds the extra tab
put word 3 of field 2 into tWord
put lineOffset(tab & tWord & tab) into tLine

Hope this helps,

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: "NR Kweto" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 26, 2001 1:33 AM
Subject: lineOffset / wholeMatches


> Hello,
>
> Perhaps I misunderstand lineOffset and its behaviour when wholeMatches is
> set to true... The aim of the word-search algorithm I'm trying to script
is
> to match words in one list to those in another. Actually, it's the line
> number that I'm after, and I want only "whole" matches (i.e., "make"
should
> match only to "make", not to "homeMAKEr"). And so, I've tried setting
> wholeMatches to true, but "0" keeps being returned even tho I know a match
> exists.
>
> %%%%%%%% START OF LENGTHY EXAMPLE %%%%%%%%%%%%%
>
> For example, these two fields:
>
> --------FIELD 1 (word families) ------------
> 1<tab>apple<tab>apples<cr>
> 2<tab>bed<tab>beds<tab>bedding<cr>
> 3<tab>home<tab>homes<tab>homemaker<cr>
> 4<tab>make<tab>makes<tab>making<tab>made
>
> -------FIELD 2 (the user's word-list) ------
> apple<cr>
> bed<cr>
> make<cr>
> sing
>
> # Here are the script variations I've tried,
> # and what is returned when I try a match to
> # to the word "make". Note that all the
> # variations start with these two lines:
>
> put field 1 into tField1 -- the word-family list
> put word 3 of field 2 into tWord -- "make"
>
> ----VARIATION (1) ---------------
> put lineOffset(tWord, tField1)
> #  This returns "3" since
> #  "homeMAKEr" is on that
> #  line, BUT "4" is what
> #  I'm after. Fair enough, tho.
>
> ----VARIATION (2) --------------
> set the wholeMatches to true
> put lineOffset(tWord, tField1)
> #  This returns "0" BUT I
> #  thought/expected "4"!!
>
> ----VARIATION (3)
> set the wholeMatches to true
> put wordOffset(tWord, tField1)
> #  This returns "14", which
> #  is a correct identifying
> #  number -- only, I want
> #  a line number, not a
> #  word number.
>
> %%%%%%%% END OF LENGTHY EXAMPLE %%%%%%%%%%%%%
>
>
> So, like I say, what am I misunderstanding...
>
> Thank you.
>
> Nicolas R Cueto
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
> Archives: http://www.mail-archive.com/[email protected]/
> Info: http://www.xworlds.com/metacard/mailinglist.htm
> Please send bug reports to <[EMAIL PROTECTED]>, not this list.
>
>


Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to