ocaml/v2.ocaml.org

fix a FIXME in rss2html.ml while printing author name in blog feed

shreyaswikriti opened this issue · 3 comments

I came across a FIXME in rss2html.ml page. that asks to check for word boundaries while printing author-name. I would like to fix this issue if approved.

@shreyaswikriti Were you able to figure out what the Fixme implies? @pitag-ha and I looked at it but couldn't decipher what the FIXME meant :)

@gs0510, what I understand from the functions
&& not(Utils.KMP.is_substring ~pat:a.name feed_author)
&& not(Utils.KMP.is_substring ~pat:feed_author a.name)
is:
this line is searching that a.name should not be present in feed_author and vice versa.
using is_substring function, it returns true even if the substring is present in between the string. Setting word boundaries returns true only if the substring is present as a whole word. Here is the explanation:
Suppose feed_author='swikriti'
a.name='shreyaswikriti'
not(Utils.KMP.is_substring ~pat:feed_author a.name) -->not(true)-->false
But there can be a possibility that this can be the name of two different persons. Giving false results won't generate a new feed_author.
Now checking using word boundary :
it results that 'swikriti' has no word boundary in 'shreyaswikriti' because 'shreyaswikriti' doesn't start with the word 'swikriti'
this gives the result that a new feed_author can be formed with the name 'swikriti'.

That makes sense @shreyaswikriti! You can go ahead and fix this :)