Giter Club home page Giter Club logo

Comments (10)

moollaza avatar moollaza commented on June 22, 2024

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.

moollaza avatar moollaza commented on June 22, 2024

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.

killerfish avatar killerfish commented on June 22, 2024

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.

moollaza avatar moollaza commented on June 22, 2024

@killerfish sounds good, go ahead and make a PR to remove it.

from zeroclickinfo-spice.

killerfish avatar killerfish commented on June 22, 2024

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.

moollaza avatar moollaza commented on June 22, 2024

@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.

moollaza avatar moollaza commented on June 22, 2024

LastFM, Reddit and IsItUp can be switched though

from zeroclickinfo-spice.

killerfish avatar killerfish commented on June 22, 2024

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.

killerfish avatar killerfish commented on June 22, 2024

ill look into LastFM

from zeroclickinfo-spice.

moollaza avatar moollaza commented on June 22, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.