Re: [xsl] Spell Check Type Matching in XPath?

Subject: Re: [xsl] Spell Check Type Matching in XPath?
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Apr 2022 20:18:33 -0000
Hi Michael,

Neat trick!

I wonder if this could somehow be combined with a multiple-pattern regular
expression on the subsequent addition side:

^(\wabc|a\wbc|ab\wc|abc\w)$

 - Chris


-----Original Message-----
From: C. M. Sperberg-McQueen cmsmcq@xxxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, April 21, 2022 4:12 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Cc: C. M. Sperberg-McQueen <cmsmcq@xxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] Spell Check Type Matching in XPath?

On Thu, 2022-04-21 at 19:01 +0000, Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx
wrote:
> Ibm looking at Jenibs code now. Ibll see what I can do with it.
> B 
> The fact that this is the best there is (a MarkMail search basically
> brought me to Mikebs response below), it suggests that therebs not
> something more obvious that I simply failed to see.

Non-obvious (at least to me), but possibly faster, given that you know already
one of the strings to be matched, may be the symmetric-deletion approach to
edit distance described by Wolf Garber [1]. It allows a fairly quick detection
of whether the candidate string is within edit distance  1 of the string
you're looking to match -- if you adjust the way you do it, you can detect
strings within distance 2.

[1]
https://urldefense.com/v3/__https://wolfgarbe.medium.com/1000x-faster-spellin
g-correction-algorithm-2012-8701fcd87a5f__;!!A4F2R9G_pg!b_Q-osvTYVJ3QjfJHdVyH
k4MMCSQPxpewiOj_JHhlnMR6lb6Aecmvwy4O2SsZNBYcD9eOeiwmQRJ7sg6LkO1_W7d5PZRrlt3Lj
PvzfqqC3rXsE9LDqpc$

Michael Sperberg-McQueen

B 
> However, Jenibs comments in her post about recursion suggests therebs
> a way to improve the code in XSLT 3/XPath 3, maybe something using
> iterateb&.
> B 
> Cheers,
> B 
> E.
> B 
> _____________________________________________
> Eliot Kimber
> Sr Staff Content Engineer
> O: 512 554 9368
> M: 512 554 9368
> servicenow.com
> LinkedInB |B TwitterB |B YouTubeB |B Facebook
> B 
> From:Michael Kay mike@xxxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
> Date: Thursday, April 21, 2022 at 1:35 PM
> To: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Subject: Re: [xsl] Spell Check Type Matching in XPath?
> [External Email]
> B 
> Jeni Tennison's work on computing Levenshtein distance in XSLT may be
> relevant:
> B 
> https://urldefense.com/v3/__http://www.jenitennison.com/2007/05/03/lev
> enshtein-distance-in-xslt-2-0.html__;!!A4F2R9G_pg!b_Q-osvTYVJ3QjfJHdVy
> Hk4MMCSQPxpewiOj_JHhlnMR6lb6Aecmvwy4O2SsZNBYcD9eOeiwmQRJ7sg6LkO1_W7d5P
> ZRrlt3LjPvzfqqC3rXsGW2eCxv$
> B 
> (It would be interesting to see it reworked for XSLT 3.0...)
> B 
> Search also for "Levenshtein distance XSLT" on Markmail.
> B 
> Michael Kay
> Saxonica
>
>
> > On 21 Apr 2022, at 18:57, Eliot Kimbereliot.kimber@xxxxxxxxxxxxxx
> > <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> > B 
> > Ibm writing a Schematron rule that tries to identify URLs where the
> > server component is close to, but not quite, bdocs.servicenow.comb,
> > i.e., bseivcenowb or bservcinowb or whatever. I also need to
> > eliminate servers that are not like servicenow, such as
> > bdocs.amazon.comb.
> > B 
> > Basically I want a the kind of fuzzy match on bservicenowb that
> > youbd get with normal spell checking.
> > B 
> > Ibm not seeing an easy way to do this in XSLT/XPath (in the context
> > of the XSLT Schematron engine in Oxygen XML).
> > B 
> > But I feel like Ibm missing some more-or-less obvious way to do this
> > with regular expression or maybe a fold or something (I can use
> > XPath 3).
> > B 
> > What am I missing?
> > B 
> > Thanks,
> > B 
> > E.
> > _____________________________________________
> > Eliot Kimber
> > Sr Staff Content Engineer
> > O: 512 554 9368
> > M: 512 554 9368
> > servicenow.com
> > LinkedInB |B TwitterB |B YouTubeB |B Facebook XSL-List info and archive
> > EasyUnsubscribeB (by email)
> B 
> XSL-List info and archive
> EasyUnsubscribe (by email)
> XSL-List info and archiveEasyUnsubscribe(by email)

Current Thread