Commit Graph

3417 Commits (df205e2335748e3ab265dafb820eda0330ca82c7)

Author SHA1 Message Date
Zaahir Moolla a8d92e3cb5 Revert "ignore reval's warnings" (#3893) 2017-01-25 18:19:31 -05:00
Zach Thompson 369c894439 ignore reval's warnings (#3892)
* Update trigger
Use Safe for evaluation with the minimum functions
Removed unnecessary capturing, redundant function calls

* Add some tests

* Remove eval since we don't allow die
Add comment about debugging failed reval

* Add rv2gv from :base_orig to allow compat with Safe 2.35
Remove prtf since that was in :base_orig which was removed

* Remove unneeded opsets

* Silence all of reval's warnings
2017-01-25 17:35:25 -05:00
Zaahir Moolla 840cdc99a1 Revert "calculator: trigger/safe" (#3890) 2017-01-25 15:00:10 -05:00
Brian Stoner cbe5785a11 Merge pull request #3885 from nalinbhardwaj/conversions
Conversions: Added length units and fixed pressure units
2017-01-25 14:35:23 -05:00
Nalin Bhardwaj 0baa2851c4 Added tests 2017-01-25 16:07:24 +00:00
Nalin Bhardwaj b0cc4c5ec7 Added nanometers, fixed others 2017-01-25 15:50:29 +00:00
Zach Thompson 2113d41a79 calculator: trigger/safe (#3878)
* Update trigger
Use Safe for evaluation with the minimum functions
Removed unnecessary capturing, redundant function calls

* Add some tests

* Remove eval since we don't allow die
Add comment about debugging failed reval

* Add rv2gv from :base_orig to allow compat with Safe 2.35
Remove prtf since that was in :base_orig which was removed

* Remove unneeded opsets
2017-01-24 15:00:37 -05:00
Rob c2392f005d Conversions: Ensuring support for "degrees centigrade" 2017-01-22 18:28:43 +00:00
Rob 0793cda4e1 Conversions: Adding failing test for convert 50 centigrade to fahrenheit 2017-01-22 18:04:16 +00:00
Matthew Ramina edfa892e18 Stopwatch: add chronometer (fixes #3843) 2017-01-20 15:49:36 -05:00
Zaahir Moolla 06196e98b5 Revert "Calculator: Dumb down the trigger" (#3868) 2017-01-20 15:49:16 -05:00
Zach Thompson 8e5d7b46e8 Calculator: Dumb down the trigger (#3866)
* Dumb down the calculator regex

* No interpolation

* Add tests to ensure changes work
2017-01-18 13:23:49 -05:00
Mariano Simone 13d752a294 Use structured_answer for GoldenRatio
This addresses part of #1163
2017-01-02 20:28:53 +00:00
Zaahir Moolla dbb9214312 ensure we handle upper case queries properly 2016-12-21 14:48:49 -05:00
Zaahir Moolla e1681517ad add back article; Use placeholder to genereate triggers with and without article 2016-12-21 14:27:22 -05:00
Zaahir Moolla ac669718b0 rephrase question as answer in subtitle 2016-12-21 13:57:46 -05:00
Zaahir Moolla b56b68923f refactor to improve flexibility; more declarative yaml 2016-12-20 15:09:06 -05:00
Zaahir Moolla 2a049d11fc use more at url to send user to Wikipedia 2016-12-20 13:51:45 -05:00
Zaahir Moolla 3bee2c80b8 Simplify tests 2016-12-20 13:42:50 -05:00
Zaahir Moolla 26709bf4ad Create new HistoricalEvents Goodie 2016-12-20 13:35:27 -05:00
Manraj Singh 190fd4444c CSS Animations Goodie (#3424)
* Base created

* YML File Updated

* Codepen logo added

* Logo renamed | urls added

* Initial version added

* Removes unwanted CSS

* Remove codepen logo

* Removes cssanimations.js

* Restructuring things

* Fixes bareword test file issue

* Test File fixed

* CSS Tricks Demos added

* Changes to tile and data

* Title added and styled

* Adds 2 demos to Goodie

* Fixes margin between title and demo

* Modularizing demos

* CSS Animations: Makes code more modular

* Data YML updated

* Fixes no file exist issue

* Minor changes in test file

* Fix: Reduces width of tile, fixes animation overflows

* Feature: CodePen AutoPen Generation added

* Fix: Test File fixed

* Add: Proportional Animations

* Add: Changing transform-origin mid-animation

* Add: Negative transform-origins

* Add: Box shadow magic

* Fix: Fix conflict in CSS

* Update: Removes unnecessary keys

* Fix: Warnings and errors for https

* Fix: Fixes text in demo 1

* Formats: Formats all CSS Stylesheets

* Fix: Handles unnecessary triggering

* Fix: Handles if variables are undefined

* Adds: Adds more test cases

* Fix: Moves logic to a separate sub routine

* Fix: Removes external resource usage
2016-12-15 15:09:55 -05:00
Zaahir Moolla 2a0fd8bc5e Revert "NameDays: Rename Czech_Republic to Czechia, new official short name" 2016-12-08 18:36:01 -05:00
Brian Stoner 126b6940c5 Merge pull request #3331 from rahiel/fix-tor-link
DuckDuckGo: fix link to Tor onion service
2016-12-04 11:15:07 -05:00
Zaahir Moolla 70970e6b86 Rename Czech_Republic to Czechia, new offical short name (#3790) 2016-12-01 01:15:33 -05:00
Rob Emery c25c8573e8 ColorPicker: Fixing over eager triggering (#3789)
* ColorPicker: Adding tests for queries that should not return

* ColorPicker: If there is a string after the triggering it needs to be a valid colour name
2016-12-01 01:08:11 -05:00
mhasbini 2198b9e2d6 add test 2016-11-14 17:31:04 +02:00
Akansh Gulati e9c9456f98 New SASS to CSS IA (#3635)
* Added the SasstoCSS library

* Started with IA

* updated the goodie var

* Updated the classes to handlebar

* Updated the URL

* Updated the test file

* Updated the cdn of sass library

* Updates on format of IA

* fix(sass_to_css): Updated the url of the library.

* fix(triggers): Updated the tests and pm file.

* fix: Updated the file to remove ID param.

* fix(sass.js): Updated the code for synchronous sass compile.

* fix(sass_to_css.js): Load library when data is actually entered.

* fix(layout): Updated the layout of buttons.
2016-10-26 13:25:45 -04:00
Akansh Gulati 9ce00a9e8e New JS Beautifier Goodie (#3640)
* Js Beautifier

* fix(js_beautifier.js): Updated the library URL to internal.

* fix(triggers): Added more triggers.

* fix(triggers): Added a few more triggers and tests.
2016-10-21 10:24:15 -04:00
Akansh Gulati c95afc52f7 New Html beautifier Goodie (#3658)
* Template Created

* Added the HTML beautifier files

* Updated the code

* Renamed the files

* Added more triggers and updated test file

* fix(html-beautify): Updated the url of library.

* fix(html_beautify): Added global scope to method.
2016-10-21 10:18:11 -04:00
Rob Emery 5957d78bde Merge pull request #3671 from amarlearning/amarlearning-css-colors
CSS Colors: fixed issue #3542
2016-10-20 08:37:53 +01:00
Caine Tighe 5c5ac2a75e Merge branch 'master' of github.com:duckduckgo/zeroclickinfo-goodies 2016-10-13 10:41:43 -04:00
Caine Tighe a4755fefe4 t/DuckDuckGo.t: remove Yahoo. 2016-10-13 10:41:39 -04:00
apandey 21e4efc386 Added meta tag in CssColors.t 2016-10-11 16:18:41 +00:00
Sahil Dua 1900b15c9d JSONValidator: Improve title/subtitle to clarify usage (#3648)
* JSONValidator: Improve title/subtitle to clarify usage
Fixes #3643

* JSONValidator: Change title/subtitle in corresponding tests
2016-10-07 09:23:47 -04:00
Ben Moon 56d6868480 RgbColor: Add support for color titles (#3574)
* Add color titles to output

* Add titles for color in front-end (hover)

Hovering over the circle gives the color 'title', and hovering over a
hex value gives the color 'name' (more suitable for HTML and similar).
2016-09-26 12:38:31 -04:00
Rob Emery a3c9cc3745 Merge pull request #3140 from duckduckgo/gd/new-lists-role
New List GoodieRole
2016-09-15 21:55:52 +01:00
Rasika Pohankar 51dafeaa31 Remove periods from titles, subtitles and plaintext responses (#3569)
* Remove periods from titles, subtitles and plaintext responses

* Update test files

* Remove concatenation

* Remove repeated tests from Cusip test file
2016-09-06 11:15:19 +01:00
Gautam krishna.R 94b217af1a Remove html_enc() from RandomDate.pm (#3599)
* removed all html_enc()

* fixed some tests still 2 failing

* Update RandomDate.pm
2016-09-05 10:40:02 +01:00
Gautam krishna.R 4d3cfd4001 Remove use of `html_enc` in Sha3 (#3578)
* Update SHA3.pm

* Update SHA3.t

* Update SHA3.t

* Update SHA3.t

* Update SHA3.t

* making tests pass
2016-09-04 16:43:40 +01:00
Ben Moon 3d6acf28b4 Merge pull request #3593 from hchienjo/add_triggers
Roman Numerals: Add more trigger words.
2016-09-03 15:44:06 +01:00
Jasmeet Singh Saini f79cef4cf4 Remove use of 'html_enc' (#3567)
* removed html_enc from ABC,ANAGRAM,AVERAGE,BASE64,BITSUM,CHARS

* string interpolation fixed

* string interpolation fix
2016-09-03 15:36:12 +01:00
hchienjo 3dcbe322ba Add tests for 'X to roman numerals' triggers. 2016-09-03 13:16:44 +00:00
Sahil Dua f13d396b5d Remove use of html_enc (#3571)
* Rot13: Remove HTML Encoding from output text

* Scramble: Remove HTML Encoding from output text

* Remove html encoding from TimezoneConverter and TitleCase IAs

* RIPEMD: Remove HTML encoding from output text

* Regexp: Remove HTML encoding

* Remove html_enc from NameDays and MD5 IAs

* Remove html_enc from MD4 and IDN

* FIGlet: Remove html enc

* Remove html enc from CaesarCipher and Braille

* Atbash: Remove html_enc from output text

* MD4: Simplify string concatenation in perl way

* NameDays: Simplify string concatenation the perl way

* NameDays: Refactor string concatenation
2016-08-31 19:58:57 +01:00
Zaahir Moolla 0982dc5e64 Merge pull request #3566 from sahildua2305/html-encoding-remove
Remove HTML encoding from multiple goodies
2016-08-24 18:35:26 -04:00
sdua 433a989c74 URLDecode: Remove HTML encoding from output text 2016-08-24 19:32:36 +00:00
sdua 3c8e910e54 URLEncode: Remove HTML Encoding of output text 2016-08-24 19:29:20 +00:00
sdua 94992d4069 CSSColors: Add more tests to verify triggering improvement 2016-08-24 19:12:50 +00:00
Zaahir Moolla 6b4223a991 Merge pull request #3346 from duckduckgo/gd/rgb-color-new-ia
New RGBColor Instant Answer
2016-08-23 10:10:20 -04:00
Daniel Davis 91ef24236a Merge pull request #3533 from hchienjo/enhancing_roman_goodie
Improve triggering of Roman Numerals
2016-08-19 10:47:41 +09:00
Daniel Davis 3ff75f651c Merge pull request #3492 from shubh1m/feature-days_since
DaysBetween: Add 'Days since' feature
2016-08-17 17:07:17 +09:00
hchienjo f9f900b420 Add tests for 'X in roman numeral' bug https://github.com/duckduckgo/zeroclickinfo-goodies/issues/3484. 2016-08-15 10:25:36 +00:00
Rob Emery f8878c8237 Merge pull request #3511 from duckduckgo/jag/conversions-base
Conversions.pm: Switch group from 'text' to 'base'.
2016-08-14 21:58:53 +01:00
Ben Moon 6e31737cdd Add support for three-digit hex codes 2016-08-13 11:08:02 +01:00
Zaahir Moolla 53be50050d Merge pull request #3400 from sahildua2305/colors-goodie-new
New CSS Colors Goodie
2016-08-11 13:25:50 -04:00
jagtalon 7172d0d85a Update tests for the template group. 2016-08-10 19:43:28 +00:00
sdua 860987823c CssColors: Remove new lines 2016-08-09 20:01:31 +00:00
Zaahir Moolla aa595401d7 Merge pull request #3518 from duckduckgo/pr/3367
Continue PR #3367
2016-08-09 14:17:35 -04:00
Ben Moon d17319fdf2 Remove trailing space from subtitle prefixes 2016-08-06 18:19:58 +01:00
Zaahir Moolla f5a020b470 Merge pull request #3425 from duckduckgo/zaahir/js-minify-improvements
JS Minify Visual Improvements
2016-08-06 11:31:52 -04:00
Shubham Gupta 0493c40362 Update DaysBetween.t 2016-08-04 05:04:31 +05:30
Shubham Gupta 0d7e45637e Update DaysBetween.t 2016-08-04 04:25:20 +05:30
iamshubh22 48a7feba0b DaysBetween: Add 'Days since' feature 2016-08-04 03:24:31 +05:30
Daniel Davis 76837bcce0 Merge pull request #3218 from tagawa/tagawa/sha3
SHA-3: Added 'sha-3' trigger
2016-08-02 23:04:06 +09:00
sdua b7c5721f14 JSONValidator: Fix tests 2016-08-01 22:07:10 +00:00
sdua 5647a62cac JSONValidator: Update tests 2016-08-01 22:02:44 +00:00
sdua 1d79237bea JSONValidator: Update tests 2016-07-30 17:14:30 +00:00
Maria Grazia Alastra 33f622f8c1 Merge pull request #3432 from sahildua2305/json-validator-new
New JSON Validator
2016-07-28 23:18:19 +02:00
Daniel Davis 51b64c295e Merge pull request #3409 from duckduckgo/gd/random-date-past-future
RandomDate: Add support for ranges
2016-07-28 17:35:07 +09:00
Zac Pappis 7ca0a066e8 Merge pull request #3243 from sahildua2305/frequency-improve
Frequency: Update IA to use List template
2016-07-25 09:18:55 -04:00
sdua a271bb587b JSONValidator: Update tests 2016-07-24 19:34:30 +00:00
sdua f2f54f0e59 JSONValidator: Update subtitle section 2016-07-24 19:19:36 +00:00
sdua 44aa73ae73 JSONValidator: Add basic template and load library 2016-07-24 18:25:07 +00:00
Ben Moon eb7e4a5813 Ensure trailing punctuation is ignored 2016-07-23 19:14:10 +01:00
msingh2 6138d325c7 Fixes Color Picker Name 2016-07-22 19:53:58 +00:00
sdua 3c4ad30c4d JSONValidator: Init v1 2016-07-21 21:31:53 +00:00
sdua 6e4d73b847 JSONValidator: Init 2016-07-21 20:47:14 +00:00
Zaahir Moolla f2a0fe934f Merge pull request #3284 from 122131/minecraft-crafting-update
Minecraft: recipe update & other enhancements
2016-07-21 12:20:04 -04:00
Olivia Haas 92e476b216 Merge pull request #3398 from duckduckgo/mintsoft/parcelforce-eager-trigger
Parcelforce: Triggering on luhn!
2016-07-21 11:19:56 -04:00
Olivia Haas 59c235876d Merge pull request #3397 from duckduckgo/mintsoft/url_decode
URLDecode: Fixing case sensitive triggers
2016-07-21 11:03:47 -04:00
Zaahir Moolla e991c50424 fix test 2016-07-21 10:59:16 -04:00
Zaahir Moolla 3e7bcfc8b5 Merge pull request #3417 from sahildua2305/refactor-js-minify
JsMinify: Code Refactor and Design Adjustments [WIP]
2016-07-21 08:17:36 -04:00
Daniel Davis d6fac752ed Merge pull request #3399 from regagain/luhn
Luhn Algorithm: Reduce subtitle redundancy
2016-07-21 11:40:32 +09:00
regagain 02eb439684 Removed full stop 2016-07-20 17:53:27 +00:00
Ben Moon 8347689276 Ensure start and end dates are different 2016-07-20 10:49:29 +01:00
msingh2 9941785610 Tests updated 2016-07-20 07:03:46 +00:00
sdua 7c1609fafb JsMinify: Add more tests for new triggers 2016-07-19 22:35:09 +00:00
sdua df042967f6 JsMinify: Update tests 2016-07-19 22:15:56 +00:00
1122131 7b509eaed1 second test file fix 2016-07-19 18:06:27 +00:00
1122131 c7cd16769f update test file for image paths 2016-07-19 17:50:54 +00:00
Maria Grazia Alastra 479814bd70 Merge pull request #3352 from sahildua2305/js-minifier
Add new JSMinify Instant Answer
2016-07-19 19:24:52 +02:00
Ben Moon 4fcf5dfed5 Add support for ranges with 'Date and Time' 2016-07-19 16:06:28 +01:00
Ben Moon c35ab307dc Add support for additional past/future forms 2016-07-19 15:41:43 +01:00
Ben Moon 67e7af47c7 Ensure unsupported ranges do not trigger 2016-07-19 14:25:58 +01:00
Ben Moon 6520e91a28 Ensure min and max dates are valid 2016-07-19 14:21:27 +01:00
Ben Moon 6460f1b727 Add support for 'between' forms 2016-07-19 14:17:27 +01:00
Ben Moon f7bf753492 Ensure (test) matches are on full string 2016-07-19 14:06:03 +01:00
Ben Moon 1fc7aeaa71 Add support for 'in the past' forms 2016-07-19 14:04:51 +01:00
Ben Moon 0231273a59 Add support for 'in the past' forms for Date 2016-07-19 13:55:57 +01:00
Ben Moon 955739a57e Add helpers for building tests 2016-07-19 13:14:36 +01:00
Daniel Davis 94b5339447 Merge pull request #3313 from tagawa/tagawa/macaddress
Refer MAC address and Generate MAC to each other
2016-07-19 20:08:21 +09:00
sdua dfd5c3d56f CssColors: Add more negative test 2016-07-18 21:41:17 +00:00
Zaahir Moolla 62f7e90d3d Update links and phrasing 2016-07-18 12:57:02 -04:00
Zach Thompson 9cdff5cf2a Make metadata test for cheat sheets a warning
Update the message so it's clear what needs to be done to get a cheat sheet in the feed.
2016-07-18 10:22:07 -06:00
sdua 6e9afed20f CssColors: Improve triggering and update tests 2016-07-16 22:54:39 +00:00
sdua 1dba7cfa89 CssColors: Add more tests 2016-07-16 22:47:53 +00:00
sdua e5c28900de CssColors: Rename share folder 2016-07-16 22:19:04 +00:00
sdua 95b197334f CssColors: Update test 2016-07-16 22:12:58 +00:00
sdua 6c898bc505 CssColors: change ID to csscolors from css_colors 2016-07-16 21:45:29 +00:00
sdua b0fcfd1b3a CssColors: Init 2016-07-16 21:36:26 +00:00
regagain 0be2c62c25 reduce subtitle redundancy 2016-07-16 09:35:51 +00:00
msingh2 2adddd17ee Added test for rgb hsv cmyk 2016-07-15 20:53:36 +00:00
Rob 126272355c ParcelForce: Adding failing test for keen triggering 2016-07-15 21:51:25 +01:00
Rob 520296bb89 URLDecode: Failing tests for trigger being case-sensitive 2016-07-15 21:32:58 +01:00
msingh2 2f1a77e268 Add more tests to ignore 2016-07-15 20:25:32 +00:00
msingh2 6cef91fce4 Fixing tests type 2016-07-15 19:40:22 +00:00
msingh2 9f7fca1088 File renamed 2016-07-15 19:34:47 +00:00
msingh2 6e4bc8d350 Basic Structured Answer added 2016-07-15 19:34:15 +00:00
Daniel Davis f8741e1292 Merge pull request #2973 from regagain/luhn
New Luhn instant answer
2016-07-14 23:24:45 +09:00
1122131 6f69014696 thirdr fix for test file 2016-07-12 15:43:33 +00:00
1122131 fb9df368fd another fix for test file 2016-07-12 15:36:02 +00:00
1122131 78cf74abb9 fixed test file 2016-07-12 15:26:04 +00:00
sdua 4315b5904d JsMinify: Fix tests 2016-07-11 20:38:20 +00:00
Ben Moon 0929a393a6 Remove unnecessary helper
@mintsoft Thus I reduce my laziness...
2016-07-11 15:57:43 +01:00
Ben Moon 69083246ed Add 'join_last' option 2016-07-11 11:04:00 +01:00
Ben Moon 4a6c23f048 Add 'join' option for formatting 2016-07-11 11:04:00 +01:00
Ben Moon d61bb26fa1 Add support for varying nested parentheses format
So `parens => '({})'` would format as '(1, {2, 3}, 4)'.
2016-07-11 11:03:59 +01:00
Ben Moon c24ecdf3d8 Improve support for 'empty' parentheses
When the user uses "parens => ''" in format_list.
2016-07-11 11:03:59 +01:00
Ben Moon e3cd02900c Add 'parens' option to 'format_list'
Allow specifying which parentheses should be used when formatting.
2016-07-11 11:03:59 +01:00
Ben Moon 0e0fcbc3af Default 'nested' to false if 'item' is provided
Generally, if an item regex is provided we won't be working with a
nested list, so turn nesting off.

Also improve validation for nested items.
2016-07-11 11:03:59 +01:00
Ben Moon 8e2dd40e7b Add test for explicitly enabled nesting
And clean the tests up a bit too.
2016-07-11 11:03:59 +01:00
Ben Moon e0017279ef Add support for parsing nested lists 2016-07-11 11:03:59 +01:00
Ben Moon 05343878a5 Move valid and invalid item regex tests to subtest
So we can show which regex is being tested.
2016-07-11 11:03:59 +01:00
Ben Moon f41a797adc Add test for undefined input to parse 2016-07-11 11:03:59 +01:00
Ben Moon b05fff92a7 Add support for basic formatting
Currently only formatting as a standard ARRAY is supported. TODO:
support separators/brackets (and perhaps detected from previous
parsing).
2016-07-11 11:03:58 +01:00
Ben Moon 82c0840185 Allow specifying a regex each item must match
For example `parse_list($text, item => qr/\d+/)` would only allow
digits.
2016-07-11 11:03:58 +01:00
Ben Moon 11b2ec875f Add test for empty string (invalid) 2016-07-11 11:03:58 +01:00
Ben Moon fb2a722b9f Add test for varying separators 2016-07-11 11:03:58 +01:00
Ben Moon 408c76f2a2 Allow lists without brackets 2016-07-11 11:03:58 +01:00
Ben Moon f379ce0d39 Fix check for defined result
Tests get confusing with Test::Deep if $got is undefined (and isn't
passed explicitly). e.g.,
`cmp_deeply(ListTester::parse_list($to_parse)...`.
2016-07-11 11:03:58 +01:00
Ben Moon a3a08de2a3 Pull common list-parsing test into sub 2016-07-11 11:03:58 +01:00
Ben Moon 7874e86491 Add test for number of items
Corrected regex to allow for empty list
2016-07-11 11:03:58 +01:00
Ben Moon 45e8bd8200 Add test for varying brackets
Also, return an ARRAY reference instead of a list (at least for now);
not sure which will make more sense in the future (probably just a
list).

/cc @mintsoft
2016-07-11 11:03:58 +01:00
Ben Moon 8556e46930 Add 'initialization' test 2016-07-11 11:03:57 +01:00
regagain e0c0436cfa changed data structure in build_structured_answer 2016-07-10 20:20:41 +00:00
regagain bd062cd7e2 Test to clarify that whitespaces should be ignored 2016-07-09 15:57:41 +00:00
sdua 42e9e7d02f Frequency: Refactor tests to remove duplication 2016-07-09 10:49:57 +00:00
msingh2 96c7c20ab1 Initial code ported 2016-07-08 13:13:08 +00:00
Ben Moon 772e6c8542 Update tests and fix logic for new front-end 2016-07-08 10:29:38 +01:00
Ben Moon 80f4c32c14 Add support for basic '+' forms
E.g., `blue + black =`.

Currently does NOT support '+' on its own, e.g., `blue + black`.
2016-07-07 14:06:13 +01:00
Ben Moon ec56c99756 Improve support for multi-word colors
Ensure the user can type 'x-y', 'x y' or 'xy' to match a color.
2016-07-07 13:44:44 +01:00
Daniel Davis 7bc3c9bc3f Merge pull request #3303 from eflyjason/pinyin
New Chinese to Pinyin Goodies
2016-07-07 17:59:52 +09:00
sdua 80d837cd65 Frequency: Reverting last two commits 2016-07-06 20:04:48 +00:00
sdua b524a56e50 Frequency: Fix minor issue with tests 2016-07-06 13:04:45 +00:00
Ben Moon 46ca72219a Add support for infix mix/tint queries
And vastly improve execution and regexp compilation time.

1. Add some early-bail shortcuts so we don't need to check massive
regexes each time.

2. Reduce some duplication of regexes and matching.

3. Improve regexes.
2016-07-06 13:55:07 +01:00
sdua 08429acb37 JsMinify: Fix tests 2016-07-06 12:51:03 +00:00
Ben Moon 04614f1f30 Add support for tinting colors 2016-07-06 12:49:41 +01:00
sdua 7d5448c1e8 JsMinify: Update Tests 2016-07-06 11:40:05 +00:00
Ben Moon cf6fd709c0 Add support for percentages in mixing
E.g., `mix 50% blue with 50% black`.
2016-07-06 12:10:46 +01:00
Ben Moon 3983157ac3 Ensure (mix) amounts are normalized for template
Instead of passing 'parts' or 'percent' etc., just pass a decimal that
we can do with what we will in the 'front' end.
2016-07-06 11:52:51 +01:00
Ben Moon f3c205cde2 Add support for 'parts' in mixing
E.g., `mix 5 parts blue and 6 parts red`.
2016-07-06 11:36:39 +01:00
Ben Moon 9675e8edb1 Add some basic custom stop words
'make', 'makes', 'paint', and 'paints'; just some common words that pop
up in queries relating to color.
2016-07-05 21:34:23 +01:00
Ben Moon 76495ed45a Add support for 'mixing' form 2016-07-05 21:31:17 +01:00
Ben Moon 06e0da0503 Add support for 'with' in mixing
E.g., `mix white with black`.
2016-07-05 21:23:39 +01:00
sdua 090784945d JsMinify: Fix tests file name 2016-07-05 20:09:47 +00:00
Ben Moon ee5e5e7e51 Vastly increase number of supported (named) colors
From about ~100-200 to upwards of 10,000 (at the cost of a little
speed).
2016-07-05 19:04:50 +01:00
Ben Moon 5c00057dd3 Add support for 'mixed' and improve relevancy
This relevancy check (stopwords) seems to do a pretty decent job.
Unfortunately there are a lot of queries involving colors - many valid
and many invalid.
2016-07-05 16:11:11 +01:00
Ben Moon 92a5b307c1 Allow using the plural of color (though singular)
Currently only returning single results, but we probably want to catch
queries like `random colors`.
2016-07-05 15:26:22 +01:00
Zaahir Moolla 6a1e1e537c Merge pull request #3342 from duckduckgo/mintsoft/dewey-alteration
Dewey: Converting to structured answer
2016-07-05 10:22:35 -04:00
Ben Moon 88317a6394 Add support for additional 'opposite' forms
* Complementary
* Can use 'for|of|to'
2016-07-05 15:21:36 +01:00
Ben Moon 51d1294bcc Ensure it is clear that opposites are for RGB
People may mean the 'RBY' model, so ensure they can see this is RGB.

*Todo: Support the 'traditional' model in the future.*
2016-07-05 15:09:50 +01:00
Ben Moon 65b293005a Add support for opposite colors 2016-07-05 14:42:41 +01:00
Ben Moon be81fa4df2 Add more sample queries (some with potential) 2016-07-05 14:03:23 +01:00
Ben Moon f4fa95c8ba Add additional sample queries
* Ensure we can trigger 'mix' in the middle of a sentence.
2016-07-05 13:55:17 +01:00
Ben Moon 43abe8678f Add invalid queries from sampling
A.k.a. the 'query suggestion' method.
2016-07-05 13:48:06 +01:00
Ben Moon c12a1ac994 Add support for common names in output
If there is a 'common' name available for the color, display that along
with the hex code.
2016-07-05 12:56:04 +01:00
Ben Moon 8316a69f73 Add support for bounds in random colors
E.g., `random color between blue and green`.
2016-07-05 12:28:40 +01:00
Ben Moon 09d622130e Add support for named colors
E.g., in `mix blue and red`.
2016-07-05 12:03:59 +01:00
Ben Moon 5707700a7c Allow use of 'and' when mixing colors 2016-07-05 11:50:31 +01:00
Ben Moon 67460e170d Allow leading '#' for hex colors 2016-07-05 11:49:19 +01:00
Ben Moon 942c87147b Add support for mixing two colors 2016-07-05 11:45:40 +01:00
Ben Moon f12586eb5f Allow using 'rand' instead of 'random' 2016-07-05 11:31:33 +01:00
Ben Moon a6c557c112 Ensure basic invalid queries do not trigger 2016-07-05 11:25:48 +01:00
Ben Moon c35d489c48 Replace use of 'content' with 'title_content'
We'll only be modifying the subtitle and title, so use the provided
content templates.
2016-07-05 10:58:39 +01:00
Ben Moon b132ab9026 Add a colored box to title
1. Add a '#' to the front of hex colors.
2. Display a colored box along with the hex value of the color.
2016-07-05 09:52:14 +01:00
Ben Moon a95a74a5b0 Add support for 'colour' form 2016-07-05 09:38:04 +01:00
Ben Moon 718820888f Add support for basic random color queries 2016-07-05 09:33:50 +01:00
Ben Moon 85bac4f846 Rename 'RGBColor' to 'RgbColor'
Due to the way the package name is handled in the metadata, `RGBColor`
causes some attributes to become `rgbcolor` rather than `rgb_color` (for
the latter `RgbColor` is required).
2016-07-05 08:52:33 +01:00
yhe e21314df4a add test to check if special pinyin like v3 can be converted correctly 2016-07-05 05:29:09 +00:00
yhe 93f0a60e53 return if content dont contain Chinese and result don't contain special Pinyin character (e.g. yes3) 2016-07-05 05:20:30 +00:00
yhe 31653a7904 return unless content have Chinese character or have number (e.g. 測試/ce4 shi4) 2016-07-05 05:14:11 +00:00
yhe 63085e3e35 add space directly after chinese character instead of adding to number 2016-07-05 05:07:38 +00:00
yhe afbc826fac add new test for upper case input 2016-07-05 04:27:02 +00:00
sdua 29ada01d3f JsMinify: Init IA 2016-07-04 22:51:31 +00:00
Ben Moon ea662bb28b Update answer_type
Use 'rgb_color' rather than 'rgbcolor'.
2016-07-04 19:28:09 +01:00
Ben Moon 8b8bd59ff1 Add files generated by DuckPAN 2016-07-04 18:57:54 +01:00
Zaahir Moolla f044243408 Merge pull request #3315 from duckduckgo/zaahir/flip-text-trigger-1
FlipText: Force start trigger to improve relevancy
2016-07-04 13:25:48 -04:00
yhe 879f2c7e01 Prevent triggers for queries that already contain pinyin 2016-07-04 10:43:39 +00:00
Rob 5a91961dd8 Dewey: Should not react to the query "dewey decimal system" without numbers etc 2016-07-04 05:50:29 +01:00
Rob b83db4c7c8 Dewey: Tests passing again; slight renaming 2016-07-04 05:50:10 +01:00
Rob 24ab262e41 Dewey: Converting the first half of tests into hashes
Dewey: All tests converted; there is now a problem with the actual implementation, each call when executed in duckpan server remembers the previous answers
2016-07-04 05:49:48 +01:00