SEARCH OOP
ENGINE FINAL PROJECT
MUHAMMAD IBRAHEEM
463
Introduction
Hello everyone,
My name is Muhammad Ibraheem, and I am a dedicated student
currently pursuing a Bachelor of Science in Computer Science
(BSCS). I am enrolled at Lahore Garrison University and am part of
the Fall 2023 cohort. My roll number is BSCS/FA-2023/463.
I am here to present my OOP final project which is “Search Engine” .
Best regards,
Muhammad Ibraheem
BSCS/FA-2023/463
• First get input from user.
• Separate all the words into
a single string.
• Pass every word to the
PROCESS function so that it finds
where it occur and how
INVOLVED IN many time.
• Then we call second
SEARCH function which sort the
vector in which it is stored
ENGINE
that where the word is
found.
• After that frequency of each
line is found and it prints
the highest frequency line.
• It also prints a solution
against the problem.
GET INPUT FROM USER
To get input from user we use function
We use getline to
get the whole line
as input
It returns the string in
which the problem stored.
STORING A STRING IN ARRAY
We convert the whole sentence into single words string and store them into
a string stream.
Here it extracts words from
whitespaces from ‘ssin’ and stores
them into ‘aar[i]’
It iterates to store the next
element into the array
INSERTION AS A MAPPED VALUE
Maps are containers that store elements in a mapped fashion. Each
element has a key value and a mapped value
A loop to iterate 20 time for
viewing all words of the
array.
Break statement for
avoiding any whitespaces to
be stored.
Insert is a built-in function Pair allows to store the
that is used to insert pair heterogeneous values under a
into map. single unit
WORD COUNT IN
FILE Iterator initiates for the map so that
so that it iterates from begin to end
in map.
It call function for
every word so that
how may time and
where word occurs It iterates in each loop to move to next value in
map.
is returned on the
function on
console. It call function for each word to check it
frequency in file.
It tells whether word is found or not
depending upon the return by the
function.
SEARCH FUNCTION
Variables in the search function defined in the class solutions
Words are passed which are
searched.
smatch is an instantiation of the match results
class template for matches on string objects.
• After that we map the whole general problem file with same method
discussed before.
REGEX SEARCH
Here we define the regex expression, and it iterates through the whole map
with the method discussed before
Word Searching Takes upper and lower case as
boundary word same.
Checks for word in the string part of
pair.
Stores the int part of the pair in vector
filter_search according to the pushkey if the
statement returns true.
CONSOLE OUTPUT PART
• Errors are handled by try catch blocks in both regex search and output time.
• Here we see if vector is empty, we return no word found and vice versa.
Block of code for word
is not found.
Block of code for word
is found.
SUB SEARCH FUNTION
• There is third function which prints the line according to the algorithm applied init.
Iterates through whole
vector.
It inserts all the values into
the first vector
filter_search[0].
It erase the other 9 vectors from the
space from begin to start.
It skips the iteration if the vector is
empty.
FREQUENCY OF • Function for finding frequency
WORDS of words that how many
times a certain word occurs in
file.
Outer loop: initiating from zero
Inner loop: initiating from +1
from inner loop
Basically, outer loop select word
from vector and inner loop
It counts that how many time matches it with all the elements
word matches. of the vector.
It stores the frequency of words
according to the index.
FINDING MAX ELEMENT
• It finds the maximum element frequency
It gives the maximum It gives the maximum
element in the array element in the array
It prints the line at that
index
PRIORITY QUESTION
• If the words aren’t found the program should store them in generic problems
file.
Append mode for
writing into the text
file.
THANK YOU