Closed synrg closed 3 years ago
Thanks, @Riviera
, for drawing this to my attention on iNat Discord.
It would be cleaner to handle this left-to-right in one pass, i.e.
--of
is immediately inserted into the expanded token list--of
is either inserted by this method or is explicitly encountered later in the argument list, no further occurrences of the token of
will be transformed into --of
, i.e. it will just be treated as the ordinary word of
Fixed by f5a10b3f2fa2ee574fc5fc44ca648bca8b2aabf5
The query
,t chicken of the woods
unexpectedly returns Verbascum thapsus (wooly mullein) (Charmin of the woods). Apparently,of
is treated as a keyword. However, in this context, where the words preceding "of" aren't part of another option, it makes no sense to treat it as a keyword. Therefore, the natural language query parser should treat it as a non-keyword instead so that the expected result, Laetiporus sulphureus (chicken of the woods) will be found instead.This could be achieved in two passes:
Expected outputs for example queries following the above steps:
,t chicken
->,t chicken
,obs of chicken
->,obs --of chicken
,t chicken of the woods
->,t --of chicken of the woods
,obs by me of chicken
->,obs --by me --of chicken
,obs by me of chicken of the woods
->,obs --by me --of chicken of the woods