Comments (10)
Examples:
triggers query_lc => qr/My spice (.+)/
should really be:
triggers startend => "my spice";
handle remainder => sub {
...
}
Also,
triggers query_lc => qr/phone number <specific regex for detecting any phone number>/;
should really be:
triggers startend => "phone number";
handle remainder => sub {
if (m/<specific regex for detecting any phone number>/) {
...
}else{
return;
}
}
from zeroclickinfo-spice.
Here's a list of the current Spice using regex triggers:
$ grep -irn "triggers query_lc" .
./lib/DDG/Spice/Airlines.pm:21:triggers query_lc => qr/^(\d+)\s*(.*?)(?:[ ]air.*?)?$|^(.*?)(?:[ ]air.*?)?\s*(\d+)$/;
./lib/DDG/Spice/IsItUp.pm:15:triggers query_lc => qr/^((?:is\s|))(?:http:\/\/)?([0-9a-z\-]+(?:\.[0-9a-z\-]+)*?)(?:(\.[a-z]{2,4})|)\s(?:up|down|working)/i;
./lib/DDG/Spice/Lastfm/Album.pm:20:triggers query_lc => qr/^([^\s]+(?:\s+[^\s]+)*)\s+(?:albums?|records?|cds?)\s+(?:by|from)?\s+([^\s]+(?:\s+[^\s]+)*)$/;
./lib/DDG/Spice/Lastfm/ArtistAlbum.pm:20:triggers query_lc => qr/^(?:$synonyms)\s+(?:(?:by|from|of)\s+)?([^\s]+(?:\s+[^\s]+)*)$
./lib/DDG/Spice/Lastfm/ArtistTracks.pm:22:triggers query_lc => qr/^(?:(?:all|the)\s+)?(?:$synonyms)\s+(?:(?:by|from|of)\s+)?([^\s]+(?:\s+[^\s]+)*)$
./lib/DDG/Spice/Lastfm/Song.pm:20:triggers query_lc => qr/ ^
./lib/DDG/Spice/Lastfm/TopTracks.pm:20:triggers query_lc => qr/(?:tops?|popular)\s+(?:10\s)?(?:tracks?|charts?|songs?|musics?)(?:\s+in\s+(?:the\s+)?)?(.*)/;
./lib/DDG/Spice/OpenSNP.pm:18:triggers query_lc => qr/(^rs[0-9]+)$/;
./lib/DDG/Spice/RandNums.pm:21:triggers query_lc => qr/^(?:rand|random) (?:numbers?|nums?)(?: (\-?[0-9]+)\s*(?:-|to)?\s*(\-?[0-9]+))?$/;
./lib/DDG/Spice/RedditSubSearch.pm:18:triggers query_lc => qr#^(?:subreddit|/?r/)\s*(\w+)$|^(\w+)\s+subreddit$#i;
./lib/DDG/Spice/Zipcode.pm:23:triggers query_lc => qr/(?:$zip_string|[a-z\d\-\s]{2,15})/;
from zeroclickinfo-spice.
Can we remove RandNums, its using wrap_string_callback => 1;
and, is also not in production. The api supports only POST, best if we can make a goodie for this.
from zeroclickinfo-spice.
@killerfish sounds good, go ahead and make a PR to remove it.
from zeroclickinfo-spice.
i looked at the rest, 2/3 doable, maybe, but i dont know what would be the threshold for tradeoff, on speed vs. the times its going to trigger (the words are relatively commonly used in queries).
from zeroclickinfo-spice.
@killerfish its definitely beneficial to the system if we can reduce the number of IA's using regex triggers.
Looking again at that list, Airlines, ZipCode and probably OpenSNP should stay as Regex triggers
from zeroclickinfo-spice.
LastFM, Reddit and IsItUp can be switched though
from zeroclickinfo-spice.
okay so for reddit, something like this wont work with word triggers, and for isitup, if we consider up|down|working|online|status (from regex) as triggers end, we wont be able to acommodate the random amount of question marks put in the query (which we support currently) so, is http://ddg.gg up
would work but is http://ddg.gg up????
wont.
from zeroclickinfo-spice.
ill look into LastFM
from zeroclickinfo-spice.
@killerfish good point about reddit, looks like that'll have to stay. The IsItUp rationale sounds like it's actually a bug though, I think we should be sepearting the question marks from the alpha characters that preceed them. That would require some work in the duckduckgo repo if you're interested. For now though, understood, we'll leave it as is.
Really appreciate you digging into those to figure out if we can switch them!
from zeroclickinfo-spice.
Related Issues (20)
- Location Sunrise/Sunset: HOT 2
- Instant answer feature not working for all stocks HOT 1
- Word definitions can't be copied HOT 1
- Translation: Instant answer doesn't work HOT 4
- Quote Of The Day: HOT 1
- BrainyQuote:
- Congress: HOT 1
- Amazon:
- Editor: doesnt show up after searching "editor" HOT 1
- Currency Conversion: HOT 3
- BBC: Access is currently only available to BBC employees HOT 1
- Actor Filmography: queries do not work HOT 1
- NFL Games: Suggestion: Add timezone info
- Actor Filmography: HOT 1
- Editor: not working HOT 3
- Translation Suggestion: Amazon Translate as upstream provider HOT 2
- Dictionary Definition:
- Currency Conversion Not Working HOT 2
- Amazon: HOT 1
- Cryptocurrency: Not rendering IA results HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zeroclickinfo-spice.