Lines Matching refs:candidate

84 bool ContainsOnlyValidXChars(const PhoneNumber& number, const string& candidate,
93 found = candidate.find_first_of("xX");
96 while (found != string::npos && found < candidate.length() - 1) {
98 char next_char = candidate[found + 1];
104 number, candidate.substr(found, candidate.length() - found))
109 string normalized_extension(candidate.substr(found,
110 candidate.length() - found));
116 found = candidate.find_first_of("xX", found + 1);
128 // First skip the country code if the normalized candidate contained it.
464 bool PhoneNumberMatcher::ParseAndVerify(const string& candidate, int offset,
467 // Check the candidate doesn't contain any formatting which would indicate
469 if (!reg_exps_->matching_brackets_->FullMatch(candidate) ||
470 reg_exps_->pub_pages_->PartialMatch(candidate)) {
478 // If the candidate is not at the start of the text, and does not start with
481 reg_exps_->regexp_factory_->CreateInput(candidate));
496 size_t lastCharIndex = offset + candidate.length();
510 if (phone_util_.ParseAndKeepRawInput(candidate, preferred_region_, &number) !=
515 if (VerifyAccordingToLeniency(leniency_, number, candidate)) {
517 match->set_raw_string(candidate);
535 const string& candidate) const {
541 !ContainsOnlyValidXChars(number, candidate, phone_util_)) {
547 !ContainsOnlyValidXChars(number, candidate, phone_util_) ||
549 number, candidate, phone_util_) ||
556 bool is_valid = CheckNumberGroupingIsValid(number, candidate, callback);
562 !ContainsOnlyValidXChars(number, candidate, phone_util_) ||
564 number, candidate, phone_util_) ||
572 bool is_valid = CheckNumberGroupingIsValid(number, candidate, callback);
583 bool PhoneNumberMatcher::ExtractInnerMatch(const string& candidate, int offset,
590 reg_exps_->regexp_factory_->CreateInput(candidate));
595 int group_start_index = static_cast<int>(candidate.length() -
599 string first_group_only = candidate.substr(0, group_start_index);
619 bool PhoneNumberMatcher::ExtractMatch(const string& candidate, int offset,
623 if (reg_exps_->slash_separated_dates_->PartialMatch(candidate)) {
628 if (reg_exps_->time_stamps_->PartialMatch(candidate)) {
631 text_.substr(offset + candidate.size())));
637 // Try to come up with a valid match given the entire candidate.
638 if (ParseAndVerify(candidate, offset, match)) {
643 // number within this candidate.
644 return ExtractInnerMatch(candidate, offset, match);
685 string candidate;
687 reg_exps_->pattern_->FindAndConsume(text.get(), &candidate)) {
688 int start = static_cast<int>(text_.length() - text->ToString().length() - candidate.length());
691 PartialMatch(candidate, &candidate);
692 if (ExtractMatch(candidate, start, match)) {
696 index = static_cast<int>(start + candidate.length());
704 const string& candidate,
709 NormalizeUTF8::NormalizeDecimalDigits(candidate);
866 // and check the candidate and number groups are the same.
878 // we only check that the candidate group ends with the formatted number
888 const string& candidate,
890 size_t first_slash_in_body = candidate.find('/');
896 size_t second_slash_in_body = candidate.find('/', first_slash_in_body + 1);
907 candidate.substr(0, first_slash_in_body);
911 return candidate.find('/', second_slash_in_body + 1) != string::npos;