Try to find a choice in what the user did:

        - If there is a quick reply, then use its payload as choice slug
        - Otherwise, try to match each choice with its intent
973885
async def rank(self):
        
        from bernard.platforms.facebook import layers as fbl

        choices = self.request.get_trans_reg('choices')

        if not choices:
            return

        if self.request.has_layer(fbl.QuickReply):
            return self._rank_qr(choices)
        elif self.request.has_layer(l.RawText):
            return await self._rank_text(choices)
1339709
def selected?(str_or_rx)
      assert_exists
      matches = options.select { |e| str_or_rx === e.text || str_or_rx === e.attribute_value(:label) }

      if matches.empty?
        raise UnknownObjectException, "Unable to locate option matching #{str_or_rx.inspect}"
      end

      matches.any? { |e| e.selected? }
    end
436048
def get_choice(prompt, choices):
    
    print()
    checker = []
    for offset, choice in enumerate(choices):
        number = offset + 1
        print("\t{}): '{}'\n".format(number, choice))
        checker.append(str(number))

    response = get_input(prompt, tuple(checker) + ('',))
    if not response:
        print("Exiting...")
        exit()

    offset = int(response) - 1
    selected = choices[offset]

    return selected
1108956
def choice(anon, obj, field, val):
    
    return anon.faker.choice(field=field)
29063
def choice(self, other):
        ''''''
        @Parser
        def choice_parser(text, index):
            res = self(text, index)
            return res if res.status or res.index != index else other(text, index)
        return choice_parser
865584
def options_match?(request)
      (options ? options.all?{ |k,v| request.original_options[k] == v || request.options[k] == v } : true)
    end
576169
def match(self, url):
        
        return list({
            message for message in self.active() if
            message.is_global or message.match(url)
        })
97490
def search_messages(self, *, query: str, **kwargs) -> SlackResponse:
        
        self._validate_xoxp_token()
        kwargs.update({"query": query})
        return self.api_call("search.messages", http_verb="GET", params=kwargs)
1237650
def get(self, sent_id, **kwargs):
        ''' '''
        if sent_id is not None and not isinstance(sent_id, int):
            sent_id = int(sent_id)
        if sent_id is None or not self.has_id(sent_id):
            if 'default' in kwargs:
                return kwargs['default']
            else:
                raise KeyError("Invalid sentence ID ({})".format(sent_id))
        return self.__sent_map[sent_id]
1112479
def regexp_prompt(prompt, regexp='.', answer=''):
    '''
    
    '''
    get_input = getattr(__builtins__, 'raw_input', input)
    while not re.search(regexp, answer):
        answer = get_input(prompt + ': ').strip()
        # If the option isn't valid, this is shown next
        message = "Your entry must match the regular expression %s" %regexp    

    return answer
1319860
function correctReply(reply, msg) {
  if (!_.isPlainObject(reply)) {
    reply = { "output": reply }
  }
  // autofill if not already exist
  reply["to"] = reply["to"] || msg["from"]
  reply["from"] = reply["from"] || ioid
  reply["hash"] = reply["hash"] || msg["hash"]
  return reply
}
1250958
def _get_user_decision(prompt_secret_decision=True, can_step_back=False):
    
    allowable_user_input = ['s', 'q']
    if prompt_secret_decision:
        allowable_user_input.extend(['y', 'n'])
    if can_step_back:
        allowable_user_input.append('b')

    user_input = None
    while user_input not in allowable_user_input:
        if user_input:
            print('Invalid input.')

        if 'y' in allowable_user_input:
            user_input_string = 'Is this a valid secret? i.e. not a false-positive (y)es, (n)o, '
        else:
            user_input_string = 'What would you like to do? '
        if 'b' in allowable_user_input:
            user_input_string += '(b)ack, '
        user_input_string += '(s)kip, (q)uit: '

        user_input = input(user_input_string)
        if user_input:
            user_input = user_input[0].lower()

    return user_input
1071827
def try_matches
      eligable_matches.each do |match,idx|
        request.breadcrumb << match
        catch(:pass) {
          dispatch(match)
          return true
        }
        request.breadcrumb.pop # Current match passed, so pop the breadcrumb before the next iteration.
      end
      response.status = (!matches.empty? && eligable_matches.empty?) ? 403 : 404
    end
977917
def choicebox(message='Pick something.', title='', choices=['program logic error - no choices specified']):
    
    return psidialogs.choice(message=message, title=title, choices=choices)
1364582
def check_hints(self, reply):
        
        try:
            f_ind = reply.index("hints")
            l_ind = reply.rindex("hints")
        except Exception:
            fail_reason = vdp_const.hints_failure_reason % (reply)
            LOG.error("%s", fail_reason)
            return False, fail_reason
        if f_ind != l_ind:
            # Currently not supported if reply contains a filter keyword
            fail_reason = vdp_const.multiple_hints_failure_reason % (reply)
            LOG.error("%s", fail_reason)
            return False, fail_reason
        try:
            hints_compl = reply.partition("hints")[2]
            hints_val = reply.partition("hints")[2][0:4]
            len_hints = int(hints_val)
            hints_val = hints_compl[4:4 + len_hints]
            hints = int(hints_val)
            if hints != 0:
                fail_reason = vdp_const.nonzero_hints_failure % (hints)
                return False, fail_reason
        except ValueError:
            fail_reason = vdp_const.format_failure_reason % (reply)
            LOG.error("%s", fail_reason)
            return False, fail_reason
        return True, None
149895
def matches_requirement?(query, option, requirement)
        !query.include?(option) || requirement.matches?(query[option], query)
      end
948767
public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
    {
        return parent::choice($this->setTextPrompt($question), $choices, $default, $attempts, $multiple);
    }