<commit_before>package DDG::Goodie::Bin2Unicode;
# ABSTRACT: Convert binary to unicode 

use DDG::Goodie;
use strict;

no warnings 'non_unicode';

zci answer_type => 'bin2unicode';
zci is_cached   => 1;

triggers query => qr{[ 01]+(?:(?:to\s+)?unicode|text|ascii)?};

handle query_lc => sub {

    return unless /([\s01]+)(?:(?:to\s+)?unicode|text|ascii)?/;

    my $bin = my $unicode = $1;
    $unicode =~ s/([01]+)/chr(oct("0b$1"))/ge;
    return "Binary '$bin' converted to unicode is '$unicode'",,
        structured_answer => {
            id => 'bin2unicode',
            name => 'Answer',
            data => {
              title => $unicode,
              subtitle => "Input: $bin",
            },

            templates => {
                group => 'text',
                moreAt => 0
            }
        };
};<commit_msg>Update trigger to capture, anchor Use handle matches<commit_after>package DDG::Goodie::Bin2Unicode;
# ABSTRACT: Convert binary to unicode 

use DDG::Goodie;
use strict;

no warnings 'non_unicode';

zci answer_type => 'bin2unicode';
zci is_cached   => 1;

triggers query => qr{^([01\s]+)(?:(?:to\s+)?(?:unicode|text|ascii))?$};

handle matches => sub {

    my $bin = my $unicode = shift;
    $unicode =~ s/([01]+)/chr(oct("0b$1"))/ge;
    return "Binary '$bin' converted to unicode is '$unicode'",,
        structured_answer => {
            id => 'bin2unicode',
            name => 'Answer',
            data => {
              title => $unicode,
              subtitle => "Input: $bin",
            },

            templates => {
                group => 'text',
                moreAt => 0
            }
        };
};
{'fraction_non_alphanumeric': 0.17522658610271905, 'fraction_numerical': 0.015105740181268883, 'mean_word_length': 2.112781954887218, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4712999', 'n_tokens_mistral': 564, 'n_tokens_neox': 518, 'n_words': 125}