We need to have all these terms match each other and are running into difficulty
orthopaedic, orthopedic, orthopaedics, orthopedics
At the moment we are dealing with most other plurals using morphology stem_en
This is our current wordforms entry for this group (the pair is duplicated in reverse or
else it only works one way)
orthopaedic > orthopedic
orthopedic > orthopaedic
orthopedics > orthopaedics
orthopaedics > orthopedics
However "orthopedics" does not then match "orthopaedic" and we can't add another entry
"orthopaedic > orthopedics" because "orthopaedic" is already present and will throw an
error when indexing.
Any advice would be greatly appreciated
the pair is duplicated in reverse or else it only works one way
That's a bad idea! Putting it both way, will lead to issues (like you've found in fact!), you changing one to the other, so they wont match properly!
You need only one direction. Sphinx takes the left word, and actully stores the right in the index. So searching for the left and the right become interchangable. If you swap the words, then they nver get a chance to match.
The complication arrises because wordforms performs 'stemming exception' - ie a word in wordforms is NOT stemmed, so that means many word wont match. So you need to
perform stemming manually on the wordforms list, and
list all variations in your wordforms file, - to the same common word
Using your example above, would be something like
orthopaedic > orthopedic
orthopedic > orthopedic
orthopedics > orthopedic
orthopaedics > orthopedic
If the word did stem would have to do that, eg
bridge > bridg
bridges > bridg
bridging > bridg
etc
It vastly bloats your wordforms file, but it can be automated.
Related
If I turn on stemming/lemmatizer in sphinx can I push a term to it "as needed" that does not utilize stemming? I know I can use wordforms to always ignore that word from stemming e.g. Radiology > Radiology but that results in never stemming the word. I'm looking for a way to not add as a wordform exception but be able to in a query in essence say 'look exactly for "Radiology" and do not stem/lemmatize". I have tried "Radiology" instead of Radiology to no avail.
http://sphinxsearch.com/docs/current.html#conf-index-exact-words
:)
Then can do
=Radiology
(in extended match mode)
If I turn lemmatizer on then plurals all work e.g
Office=Offices
Dog=Dogs
However if I make a wordform unrelated to plural like
100 > Hundred
Then Hundred will not match Hundreds (I realize not a perfect example so don't take it literally).
So the question is is there any other type of wordform or process that will allow you to first apply stemming and then wordform? So in this case it would stem Hundred to Hundreds so that 100 would match both Hundred and Hundreds?
See http://sphinxsearch.com/docs/current.html#conf-wordforms
There is special syntax to use with morphology.
100 => Hundr
You need to apply the morphology to the right side manually.
Some code here:
http://sphinxsearch.com/forum/view.html?id=13907
that might help with creating this style of wordforms.
we are an anatomy platform and use sphinx for our search. We want to make our search more fuzzier and started to use metaphone to correct spelling mistakes. It finds for example phalanges even though the search word is falanges.
That's good but we want more. We want that the user could type in falange or even falang and we still find phalanges. Any ideas how to accomplish this?
If you are interested you can checkout our sphinx config file here.
Thanks!
Well you can enable both metaphone and min_prefix_len on an index at once. It will sort of work.
falange*
might then just work. (to match phalanges)
The problem is the 'stripped' letters may change the 'sound' of the word (because change the pronunciation)
eg falange becomes FLNJ, but falang acully becomes FLNK - so they no longer 'substrings' of one another. (ie phalanges becomes FLNJS, which FLNK* wont match)
... to be honest I dont know a good solution. You could perhaps get better results, if was to apply stemming, BEFORE metaphone. (so the endings that change the pronouncation of the words are removed.
Alas Sphinx can't do this. If you enable stemming and metaphone together, only ONE of the processors will ever fire.
Two possible solutions, implement stemming outside of sphinx (or maybe with regexp_filter. Not sure if say a porter stemmer can be implemnented purely with regular expressions)
or modify sphinx, so that ALL morphology processors apply. (rather than just the first one that changes the word)
I am trying to improve my Sphinx configuration and I have a trouble with words ending with apostrophes.
For example, for Surfin' USA result, searching with "Surfin USA" returns match but "Surfing USA" doesn't return anything. How can I set Sphinx to return result for such situation?
Hmm, thats an interesting one. Not sure sphinx can automatically deal with this, because it has no way of knowing what the Apostrophe is meant to represent. I suppose there are cases where it could be multiple things.
The only way I can think would be to list them in exceptions, you can build a list of all words want to support
Surfin' > Surfing
Have to use exceptions to be able to use the apostrophe
You might want to add
Surfin > Surfing
too, so can search without the apostrophe too.
TL;DR I want to use Xcodes finder with regular expressions to update outdated function calls.
Example 'numFrames:??? endFrame:#"step1*_0??? text=" "' where the question marks are replaced by a 1-3 digit number and * is a letter and just delete all of that.
Long Version First off I know I need to refresh my memory on regular expressions but I feel like I'm banging my head into a wall on this...
I want to use finder to update my calls to a function. I was playing ~400 image sequences in my application and it was impractical to keep updating the individual sequence lengths when they would get updated. Now to solve that I have my application figuring out the length on its own, but I still have outdated length declarations. I could go through one at a time and delete them out but I know Finder can use regular expressions...
What I want to delete out is 'numFrames:??? endFrame:#"step1*_0??? text=" "' where the question marks are replaced by a 1-3 digit number and * is a letter.
If you could point me to a good xcode and regular expression guide (Teach a man to fish...) or just tell me how to do this, either would be great.
In the find control click the magnifying glass and choose "Show Find Options". Change the Style option from "Textual" to "Regular Expression". Type your regular expression into the search box.