Open daniel-gener8tor opened 2 years ago
Hi @wanasit
I know this is a very old issue but I wrote the exact same custom parser as your code above and it does not function as expected. The parsed result returned is []
I can confirm with debug statements that the pattern matches and the extract function is executed. However it does not return any results.
I tested your code above and my own version of it and neither work as expected. Do you have insight into this issue ?
We have identified the "UnlikelyFormatFilter" refiner as the reason why the parsedResult is being filtered out. We worked around it by replacing the refiner with a version that does NOT do the following refinement
if (result.text.replace(" ", "").match(/^\d(.\d)?$/)) {
context.debug(() => {
console.log(Removing unlikely result '${result.text}'
);
});
return false;
}
At the moment we are replacing the refiner using its index. We tried using constructor name but that did not work on production.
@wanasit could you expose the refiner names so users are able to replace/modify them as required.
Sorry for my slow reply. I don't know if we want to have that in the default Chrono.
Would adding a custom parser work for your case? https://github.com/wanasit/chrono#parser