duckduckgo / zeroclickinfo-spice

DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
https://duckduckhack.com/
Other
548 stars 942 forks source link

Thesaurus.pm misparses words beginning with "for" #186

Closed ghost closed 11 years ago

ghost commented 11 years ago

Compare "synonym forget" and "synonym for forget"

majuscule commented 11 years ago

Hi @tankbard!

I've fixed the error and added new test cases to prevent it from happening again. You can see my changes in commit 2671e9727ada2d2eeda63efddc505088c0e5384a, which has been released in version 0.207, and will go live with our next deploy.

Thank you for pointing this out :-)

ghost commented 11 years ago

Why the mandatory space on line 26?

On Tue, Jul 23, 2013 at 6:15 PM, Dylan Lloyd notifications@github.comwrote:

Hi @tankbard https://github.com/tankbard!

I've fixed the error and added new test cases to prevent it from happening again. You can see my changes in commit 2671e97https://github.com/duckduckgo/zeroclickinfo-spice/commit/2671e9727ada2d2eeda63efddc505088c0e5384a, which has been released in version 0.207, and will go live with our next deploy.

Thank you for pointing this out :-)

— Reply to this email directly or view it on GitHubhttps://github.com/duckduckgo/zeroclickinfo-spice/issues/186#issuecomment-21450227 .

majuscule commented 11 years ago

It's not mandatory. The * character is a zero-or-more modifier. Because I bind the regex to the start and end (/^...$/), this allows it to match if the user accidentally includes a trailing space. Also note that the regex is now using the /x flag, meaning that all whitespace is insignificant unless escaped.

ghost commented 11 years ago

Ah, okay. The /x would do it (I was referring to the space before the \s*). Sorry for the trouble.

On Tue, Jul 23, 2013 at 6:34 PM, Dylan Lloyd notifications@github.comwrote:

It's not mandatory. The * character is a zero-or-more modifier. Because I bind the regex to the start and end (/^...$/), this allows it to match if the user accidentally includes a trailing space. Also note that the regex is now using the /x flag, meaning that all whitespace is insignificant unless escaped.

— Reply to this email directly or view it on GitHubhttps://github.com/duckduckgo/zeroclickinfo-spice/issues/186#issuecomment-21451364 .