Skip to content
This repository has been archived by the owner on May 8, 2022. It is now read-only.

Fuse can't find exact match in longer sting #38

Open
WillBishop opened this issue Feb 20, 2020 · 1 comment
Open

Fuse can't find exact match in longer sting #38

WillBishop opened this issue Feb 20, 2020 · 1 comment
Labels

Comments

@WillBishop
Copy link

In this operation, Fuse is given a pattern

pattern = neighbours

And a string

content = Mr and Mrs Dursley, of number four, Privet Drive, were proud to say that they were perfectly normal, thank you very much. They were the last people you’d expect to be involved in anything strange or mysterious, because they just didn’t hold with such nonsense. Mr Dursley was the director of a firm called Grunnings, which made drills. He was a big, beefy man with hardly any neck, although he did have a very large moustache. Mrs Dursley was thin and blonde and had nearly twice the usual amount of neck, which came in very useful as she spent so much of her time craning over garden fences, spying on the neighbours

However despite there being an exact match, the operation fails.

Fuse().search(pattern, in: content) //Produces nil

I'm using the blocking version of search, and would like to continue to do so if possible.

Appreciate any help, thanks!

@va7map
Copy link

va7map commented Mar 7, 2020

Your pattern occurs at the 611th position in content. Using the default distance of 100, the score (approximately 611 ÷ 100) will be much too high.

You can either increase location if you're expecting pattern to occur far from the beginning, or increase distance so it has a smaller impact on the score:

Fuse(location: 600).search(pattern, in: content)  // score = 0.07
Fuse(distance: 6000).search(pattern, in: content) // score = 0.10

@krisk krisk added the question label May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants