NR Kweto wrote:
> 
> 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...
> 
hi Nicolas,
perhaps this change will give you the right answer for your variation 3

> ----VARIATION (3)
set the wholeMatches to true
put the number of lines in word 1 to wordOffset(tWord,tField1) of tField1

or if your application permits, put a TAB at the end of each line in the field 1 like
> --------FIELD 1 (word families) ------------
> 1<tab>apple<tab>apples<tab><cr>

> ----VARIATION (1) ---------------
> put lineOffset(tab & tWord & tab, tField1)

regards 
Eugen

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