515 |
|
{ |
516 |
|
if (required[index0].find("URL ") == 0) |
517 |
|
{ |
518 |
< |
string fred = required[index0].substr(4); |
519 |
< |
value += find(fred, lowerDescription, |
518 |
> |
value += find(required[index0].substr(4), lowerDescription, |
519 |
|
occurrencesDescription); |
520 |
|
} |
521 |
|
else if (required[index0].find("TITLE ") == 0) |
522 |
|
{ |
523 |
< |
string fred = required[index0].substr(6); |
525 |
< |
value += find(fred, lowerDescription, |
523 |
> |
value += find(required[index0].substr(6), lowerDescription, |
524 |
|
occurrencesDescription); |
525 |
|
} |
526 |
|
else if (required[index0].find("TEXT ") == 0) |
527 |
|
{ |
528 |
< |
string fred = required[index0].substr(5); |
531 |
< |
value += find(fred, lowerDescription, |
528 |
> |
value += find(required[index0].substr(5), lowerDescription, |
529 |
|
occurrencesDescription); |
530 |
|
} |
531 |
|
else |
563 |
|
{ |
564 |
|
if (words[index1].find("URL ") == 0) |
565 |
|
{ |
566 |
< |
string fred = words[index1].substr(4); |
567 |
< |
value += find(fred, lowerDescription, |
571 |
< |
occurrencesDescription); |
566 |
> |
value += find(words[index1].substr(4), |
567 |
> |
lowerDescription, occurrencesDescription); |
568 |
|
} |
569 |
|
else if (words[index1].find("TITLE ") == 0) |
570 |
|
{ |
571 |
< |
string fred = words[index1].substr(6); |
572 |
< |
value += find(fred, lowerDescription, |
577 |
< |
occurrencesDescription); |
571 |
> |
value += find(words[index1].substr(6), |
572 |
> |
lowerDescription, occurrencesDescription); |
573 |
|
} |
574 |
|
else if (words[index1].find("TEXT ") == 0) |
575 |
|
{ |
576 |
< |
string fred = words[index1].substr(5); |
577 |
< |
value += find(fred, lowerDescription, |
583 |
< |
occurrencesDescription); |
576 |
> |
value += find(words[index1].substr(5), |
577 |
> |
lowerDescription, occurrencesDescription); |
578 |
|
} |
579 |
|
else |
580 |
|
{ |
599 |
|
{ |
600 |
|
if (required[number0].find("URL ") == 0) |
601 |
|
{ |
602 |
< |
string fred = required[number0].substr(4); |
609 |
< |
value += find(fred, |
602 |
> |
value += find(required[number0].substr(4), |
603 |
|
lowerHeading); |
604 |
|
} |
605 |
|
else if (required[number0].find("TITLE ") == 0) |
606 |
|
{ |
607 |
< |
string fred = required[number0].substr(6); |
615 |
< |
value += find(fred, |
607 |
> |
value += find(required[number0].substr(6), |
608 |
|
lowerHeading); |
609 |
|
} |
610 |
|
else if (required[number0].find("TEXT ") == 0) |
611 |
|
{ |
612 |
< |
string fred = required[number0].substr(5); |
621 |
< |
value += find(fred, |
612 |
> |
value += find(required[number0].substr(5), |
613 |
|
lowerHeading); |
614 |
|
} |
615 |
|
else |
646 |
|
{ |
647 |
|
if (words[number].find("URL ") == 0) |
648 |
|
{ |
649 |
< |
string fred = words[number].substr(4); |
659 |
< |
value += find(fred, |
649 |
> |
value += find(words[number].substr(4), |
650 |
|
lowerHeading); |
651 |
|
} |
652 |
|
else if (words[number].find("TITLE ") == 0) |
653 |
|
{ |
654 |
< |
string fred = words[number].substr(6); |
665 |
< |
value += find(fred, |
654 |
> |
value += find(words[number].substr(6), |
655 |
|
lowerHeading); |
656 |
|
} |
657 |
|
else if (words[number].find("TEXT ") == 0) |
658 |
|
{ |
659 |
< |
string fred = words[number].substr(5); |
671 |
< |
value += find(fred, |
659 |
> |
value += find(words[number].substr(5), |
660 |
|
lowerHeading); |
661 |
|
} |
662 |
|
else |
680 |
|
|
681 |
|
if (required[index].find("URL ") == 0) |
682 |
|
{ |
683 |
< |
string fred = required[index].substr(4); |
696 |
< |
string martha = lowerURL.substr(7); |
697 |
< |
inURL = find(fred, martha); |
683 |
> |
inURL = find(required[index].substr(4), lowerURL.substr(7)); |
684 |
|
|
685 |
|
if (inURL) |
686 |
|
{ |
687 |
< |
string fred = required[index].substr(4); |
702 |
< |
inTitle = find(fred, lowerTitle, |
687 |
> |
inTitle = find(required[index].substr(4), lowerTitle, |
688 |
|
occurrencesTitle); |
689 |
< |
string martha = required[index].substr(4); |
705 |
< |
inText = find(martha, lowerText, |
689 |
> |
inText = find(required[index].substr(4), lowerText, |
690 |
|
occurrencesText); |
691 |
|
|
692 |
|
if (!inTitle) inTitle++; |
695 |
|
} |
696 |
|
else if (required[index].find("TITLE ") == 0) |
697 |
|
{ |
698 |
< |
string fred = required[index].substr(6); |
715 |
< |
inTitle = find(fred, lowerTitle, |
698 |
> |
inTitle = find(required[index].substr(6), lowerTitle, |
699 |
|
occurrencesTitle); |
700 |
|
|
701 |
|
if (inTitle) |
702 |
|
{ |
703 |
< |
string fred = required[index].substr(6); |
704 |
< |
string martha = lowerURL.substr(7); |
722 |
< |
inURL = find(fred, martha); |
723 |
< |
string george = required[index].substr(6); |
724 |
< |
inText = find(george, lowerText, |
703 |
> |
inURL = find(required[index].substr(6), lowerURL.substr(7)); |
704 |
> |
inText = find(required[index].substr(6), lowerText, |
705 |
|
occurrencesText); |
706 |
|
|
707 |
|
if (!inURL) inURL++; |
710 |
|
} |
711 |
|
else if (required[index].find("TEXT ") == 0) |
712 |
|
{ |
713 |
< |
string fred = required[index].substr(5); |
734 |
< |
inText = find(fred, lowerText, |
713 |
> |
inText = find(required[index].substr(5), lowerText, |
714 |
|
occurrencesText); |
715 |
|
|
716 |
|
if (inText) |
717 |
|
{ |
718 |
< |
string fred = required[index].substr(5); |
719 |
< |
string martha = lowerURL.substr(7); |
741 |
< |
inURL = find(fred, martha); |
742 |
< |
string george = required[index].substr(5); |
743 |
< |
inTitle = find(george, lowerTitle, |
718 |
> |
inURL = find(required[index].substr(5), lowerURL.substr(7)); |
719 |
> |
inTitle = find(required[index].substr(5), lowerTitle, |
720 |
|
occurrencesTitle); |
721 |
|
|
722 |
|
if (!inURL) inURL++; |
725 |
|
} |
726 |
|
else |
727 |
|
{ |
728 |
< |
string fred = lowerURL.substr(7); |
753 |
< |
inURL = find(required[index], fred); |
728 |
> |
inURL = find(required[index], lowerURL.substr(7)); |
729 |
|
inTitle = find(required[index], lowerTitle, occurrencesTitle); |
730 |
|
inText = find(required[index], lowerText, occurrencesText); |
731 |
|
} |
752 |
|
{ |
753 |
|
unsigned inURL = 0, inTitle = 0, inText = 0; |
754 |
|
|
755 |
< |
string fred = lowerURL.substr(7); |
781 |
< |
inURL = find(excluded[index], fred); |
755 |
> |
inURL = find(excluded[index], lowerURL.substr(7)); |
756 |
|
inTitle = find(excluded[index], lowerTitle); |
757 |
|
inText = find(excluded[index], lowerText); |
758 |
|
|
804 |
|
|
805 |
|
if (words[number].find("URL ") == 0) |
806 |
|
{ |
807 |
< |
string fred = words[number].substr(4); |
834 |
< |
string martha = lowerURL.substr(7); |
835 |
< |
inURL = find(fred, martha); |
807 |
> |
inURL = find(words[number].substr(4), lowerURL.substr(7)); |
808 |
|
|
809 |
|
if (inURL) |
810 |
|
{ |
811 |
< |
string fred = words[number].substr(4); |
840 |
< |
inTitle = find(fred, lowerTitle, |
811 |
> |
inTitle = find(words[number].substr(4), lowerTitle, |
812 |
|
occurrencesTitle); |
813 |
< |
string martha = words[number].substr(4); |
843 |
< |
inText = find(martha, lowerText, |
813 |
> |
inText = find(words[number].substr(4), lowerText, |
814 |
|
occurrencesText); |
815 |
|
|
816 |
|
if (!inTitle) inTitle++; |
819 |
|
} |
820 |
|
else if (words[number].find("TITLE ") == 0) |
821 |
|
{ |
822 |
< |
string fred = words[number].substr(6); |
853 |
< |
inTitle = find(fred, lowerTitle, |
822 |
> |
inTitle = find(words[number].substr(6), lowerTitle, |
823 |
|
occurrencesTitle); |
824 |
|
|
825 |
|
if (inTitle) |
826 |
|
{ |
827 |
< |
string fred = words[number].substr(6); |
828 |
< |
string martha = lowerURL.substr(7); |
860 |
< |
inURL = find(fred, martha); |
861 |
< |
string george = words[number].substr(6); |
862 |
< |
inText = find(george, lowerText, |
827 |
> |
inURL = find(words[number].substr(6), lowerURL.substr(7)); |
828 |
> |
inText = find(words[number].substr(6), lowerText, |
829 |
|
occurrencesText); |
830 |
|
|
831 |
|
if (!inURL) inURL++; |
834 |
|
} |
835 |
|
else if (words[number].find("TEXT ") == 0) |
836 |
|
{ |
837 |
< |
string fred = words[number].substr(5); |
872 |
< |
inText = find(fred, lowerText, |
837 |
> |
inText = find(words[number].substr(5), lowerText, |
838 |
|
occurrencesText); |
839 |
|
|
840 |
|
if (inText) |
841 |
|
{ |
842 |
< |
string fred = words[number].substr(5); |
843 |
< |
string martha = lowerURL.substr(7); |
879 |
< |
inURL = find(fred, martha); |
880 |
< |
string george = words[number].substr(5); |
881 |
< |
inTitle = find(george, lowerTitle, |
842 |
> |
inURL = find(words[number].substr(5), lowerURL.substr(7)); |
843 |
> |
inTitle = find(words[number].substr(5), lowerTitle, |
844 |
|
occurrencesTitle); |
845 |
|
|
846 |
|
if (!inURL) inURL++; |
849 |
|
} |
850 |
|
else |
851 |
|
{ |
852 |
< |
string fred = lowerURL.substr(7); |
891 |
< |
inURL = find(words[number], fred); |
852 |
> |
inURL = find(words[number], lowerURL.substr(7)); |
853 |
|
inTitle = find(words[number], lowerTitle, occurrencesTitle); |
854 |
|
inText = find(words[number], lowerText, occurrencesText); |
855 |
|
} |
893 |
|
inText : 0; |
894 |
|
} |
895 |
|
|
896 |
< |
unsigned Ranker::find(string& word, string& where) |
896 |
> |
unsigned Ranker::find(string word, const string& where) |
897 |
|
{ |
898 |
|
unsigned value = 0; |
899 |
|
|
938 |
|
return value; |
939 |
|
} |
940 |
|
|
941 |
< |
unsigned Ranker::find(string& word, string& where, map<unsigned, unsigned>& |
942 |
< |
occurrences) |
941 |
> |
unsigned Ranker::find(string word, const string& where, map<unsigned, |
942 |
> |
unsigned>& occurrences) |
943 |
|
{ |
944 |
|
unsigned value = 0; |
945 |
|
|
987 |
|
return value; |
988 |
|
} |
989 |
|
|
990 |
< |
unsigned Ranker::phrase(string& phrase, string& where) |
990 |
> |
unsigned Ranker::phrase(const string& phrase, const string& where) |
991 |
|
{ |
992 |
|
unsigned value = 0; |
993 |
|
vector<string> words; |
1014 |
|
return value; |
1015 |
|
} |
1016 |
|
|
1017 |
< |
unsigned Ranker::phrase(string& phrase, string& where, map<unsigned, unsigned>& |
1018 |
< |
occurrences) |
1017 |
> |
unsigned Ranker::phrase(const string& phrase, const string& where, |
1018 |
> |
map<unsigned, unsigned>& occurrences) |
1019 |
|
{ |
1020 |
|
unsigned value = 0; |
1021 |
|
vector<string> words; |
1041 |
|
return value; |
1042 |
|
} |
1043 |
|
|
1044 |
< |
unsigned Ranker::phrase(vector<string>& words, unsigned word, unsigned& begin, |
1045 |
< |
bool start, string& where) |
1044 |
> |
unsigned Ranker::phrase(const vector<string>& words, unsigned word, unsigned& |
1045 |
> |
begin, bool start, const string& where) |
1046 |
|
{ |
1047 |
|
unsigned value = 0; |
1048 |
|
bool end = !(word + 1 < words.size()); |
1103 |
|
return value; |
1104 |
|
} |
1105 |
|
|
1106 |
< |
unsigned Ranker::phrase(vector<string>& words, unsigned word, unsigned& begin, |
1107 |
< |
bool start, string& where, map<unsigned, unsigned>& occurrences) |
1106 |
> |
unsigned Ranker::phrase(const vector<string>& words, unsigned word, unsigned& |
1107 |
> |
begin, bool start, const string& where, map<unsigned, unsigned>& |
1108 |
> |
occurrences) |
1109 |
|
{ |
1110 |
|
unsigned value = 0; |
1111 |
|
bool end = !(word + 1 < words.size()); |