0% found this document useful (0 votes)
54 views

AJP Microproject

The document describes a project report submitted by four students on creating a Wikipedia search engine. It includes a certificate signed by the teacher and head of department approving the project work. It also contains statements by each student declaring the work as their original work. The report provides an introduction to Java Swing, features of the Swing class, the Swing class hierarchy, information about the Wikipedia API, uses of the API, project code, project output, and references. The primary goal of the project was to build a user-friendly search interface to retrieve and display relevant Wikipedia articles.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

AJP Microproject

The document describes a project report submitted by four students on creating a Wikipedia search engine. It includes a certificate signed by the teacher and head of department approving the project work. It also contains statements by each student declaring the work as their original work. The report provides an introduction to Java Swing, features of the Swing class, the Swing class hierarchy, information about the Wikipedia API, uses of the API, project code, project output, and references. The primary goal of the project was to build a user-friendly search interface to retrieve and display relevant Wikipedia articles.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Project Report

ON

WIKIPEDIA SEARCH ENGINE

Submitted by

Aliasgar Jhalodwala
Arfa Shaikh
Taufique Shaikh
Arif Saiyed

Project guide

PROF. SARIKA PATIL

H.J. THIM TRUST’S

THEEM COLLEGE OF ENGINEERING

Boisar Chilhar Road, Boisar (E), Palghar - 401501

2022-23

1
CERTIFICATE

This is to certify that the report has been submitted by Arif Saiyed (2116350069),
Taufique Shaikh (2116350070), Arfa Shaikh (2116350071), Aliasgar Jhalodwala
(2116350088).

This project work has been completed by 2023-24 year students of course
COMPUTER ENGINEERING as a part of team work prescribed by Maharashtra
State Board of Technical Education, Mumbai.

We have guided and assisted the students for the above work, and have been
satisfactory /good / very good.

Signature of Teacher Signature of HOD Signature of Principal


(Prof. Sarika Patil) (Prof. Rosy Bhoi) (Dr. Saiyed Layak)

2
STATEMENT BY THE CANDIDATE

I hereby declare that the project work entitled “Wikipedia Search Engine” submitted
to Theem College of Engineering, is a record of an original work done by me under
the guidance of Prof. Sarika Patil. The results embodied in this thesis have not been
submitted to any other University or Institute for the award of any degree or diploma.

Aliasgar Jhalodwala

3
STATEMENT BY THE CANDIDATE

I hereby declare that the project work entitled “Wikipedia Search Engine” submitted
to Theem College of Engineering, is a record of an original work done by me under
the guidance of Prof. Sarika Patil. The results embodied in this thesis have not been
submitted to any other University or Institute for the award of any degree or diploma.

Arfa Shaikh

4
STATEMENT BY THE CANDIDATE

I hereby declare that the project work entitled “Wikipedia Search Engine” submitted
to Theem College of Engineering, is a record of an original work done by me under
the guidance of Prof. Sarika Patil. The results embodied in this thesis have not been
submitted to any other University or Institute for the award of any degree or diploma.

Taufique Shaikh

5
STATEMENT BY THE CANDIDATE

I hereby declare that the project work entitled “Wikipedia Search Engine” submitted
to Theem College of Engineering, is a record of an original work done by me under
the guidance of Prof. Sarika Patil. The results embodied in this thesis have not been
submitted to any other University or Institute for the award of any degree or diploma.

Arif Saiyed

6
ACKNOWLEDGEMENT

Apart from the efforts of ourselves, the success of the project depends largely on the
encouragement and guidance of many others. We would like to take this opportunity to
express our gratitude to the people who have been instrumental in the successful
completion of this project.

We would like to express a deep sense of gratitude to Principal Saiyed Layak and our
Head of the Department Prof. Rosy Bhoi for their cordial support as they gave the
permission to use all required equipment and the necessary material to complete the
project.

We would like to extend our sincerest gratitude to Prof. Sarika Patil for her guidance
and supervision as well as for providing necessary information regarding the project
and also for the support in completing the project.

Finally, we would heartfully thank to our parents and friends for being with us end
encouraging us throughout the project.

Aliasgar Jhalodwala
Arfa Shaikh
Taufique Shaikh
Arif Saiyed

7
ABSTRACT

The "Wikipedia Search Engine" project is a software application designed to provide


users with a user-friendly graphical interface for searching and retrieving information
from the vast repository of knowledge available on Wikipedia. Leveraging the power
of Java's javax.swing GUI library and the Wikipedia API, this project offers an
efficient and intuitive means for users to access Wikipedia content.

The primary objectives of this project were to create an easy-to-use interface that
enables users to enter search queries, retrieve search results, and display relevant
Wikipedia articles in a readable format. The project achieves these goals by
integrating core components, including text fields, buttons, and text areas, into a
seamless and aesthetically pleasing user interface.

The "Wikipedia Search Engine" project not only provides a valuable tool for
individuals seeking knowledge from Wikipedia but also serves as an educational
endeavor in Java Swing GUI development and API integration. The utilization of
modern software engineering principles, such as modular design and error handling,
demonstrates the practical application of software engineering concepts.

8
TABLE OF CONTENTS

Sr. No. Name Page No.


1 Introduction (Java Swing) 10

2 Features of Swing Class 11

3 Swing Class Hierarchy 12

4 About Wikipedia API 13

5 Uses of API 14

6 Project Code 15

7 Project Ouput 20

8 References 22

9
INTRODUCTION (JAVA SWING)

Swing has about four times the number of User Interface [UI] components as AWT
and is part of the standard Java distribution. By today’s application GUI requirements,
AWT is a limited implementation, not quite capable of providing the components
required for developing complex GUI’s required in modern commercial applications.
The AWT component set has quite a few bugs and really does take up a lot of system
resources when compared to equivalent Swing resources. Netscape introduced its
Internet Foundation Classes [IFC] library for use with Java. Its Classes became very
popular with programmers creating GUI’s for commercial applications.

• Swing is a Set Of API ( API- Set Of Classes and Interfaces )


• Includes New and improved Components that have been enhancing the looks
and Functionality of GUIs’
• Swing can be used to build (Develop) The Standalone swing GUI Apps Also as
Servlets And Applets
• It Employs model/view design architecture
• Swing is more portable and more flexible than AWT, The Swing is built on top
of the AWT
• Java Swing Components are Platform-independent And The Swing
Components are lightweight
• Swing Supports a Pluggable look and feels And Swing provides more powerful
components such as tables, lists, Scrollpanes, Colourchooser, tabbedpane, etc

10
FEATURES OF SWING CLASS

1. Advanced features such as JTable, JTabbedPane, JScollPane, etc.


2. Java is a platform-independent language and runs on any client machine, the
GUI look and feel, owned and delivered by a platform-specific O/S, simply
does not affect an application’s GUI constructed using Swing components
3. Lightweight Components: Starting with the JDK 1.1, its AWT-supported
lightweight component development. For a component to qualify as
lightweight, it must not depend on any non-Java [O/s based) system classes.
Swing components have their own view supported by Java’s look and feel
classes.
4. Pluggable Look and Feel: This feature enables the user to switch the look and
feel of Swing components without restarting an application. The Swing library
supports components’ look and feels that remain the same across all platforms
wherever the program runs. The Swing library provides an API that gives real
flexibility in determining the look and feel of the GUI of an application
5. Highly customizable – Swing controls can be customized in a very easy way as
visual appearance is independent of internal representation.
6. Rich controls– Swing provides a rich set of advanced controls like Tree
TabbedPane, slider, colorpicker, and table controls.

11
SWING CLASSES HIERARCHY

12
ABOUT WIKIPEDIA API

Knowledge access is more important than ever in the era of digital information.
Wikipedia is one of the most extensive and easily available knowledge bases on the
internet, which has developed into a large repository of information. Wikipedia is a
useful tool for anyone looking to learn more about a variety of topics, from history
and science to culture and technology, thanks to its vast collection of articles covering
a wide range of themes.

This report's "Wikipedia Search Engine" project is an effort to harness the abundance
of knowledge found on Wikipedia and make it easily accessible to users via a user-
friendly graphical interface.

At the heart of this project lies the utilization of the Wikipedia API, specifically the
endpoint at https://en.wikipedia.org/w/api.php. This API provides programmatic
access to Wikipedia's vast collection of articles and metadata, enabling developers to
create applications that interact with and retrieve data from Wikipedia's database.

13
USES OF THE WIKIPEDIA API

The Wikipedia API, with its versatile features and rich dataset, offers a multitude of
applications across various domains. In the context of the "Wikipedia Search Engine"
project, the API serves several key purposes:

1. Information Retrieval: The API facilitates real-time searching and retrieval of


Wikipedia articles based on user-defined queries. This capability is invaluable
for users seeking specific information on a wide range of topics.
2. Content Parsing: Wikipedia articles are often adorned with HTML formatting
and metadata. The API allows for the extraction and parsing of article content,
stripping away unnecessary markup to present users with clear and concise
textual information.
3. Language Agnostic: Wikipedia is available in multiple languages, making it a
global knowledge resource. The Wikipedia API supports language-specific
queries, enabling users to access information in their preferred language.
4. Error Handling: Robust error handling capabilities in the API ensure graceful
management of issues such as network errors or API limitations, ensuring a
seamless user experience.
5. Educational Tools: Beyond its use in search engines, the Wikipedia API finds
application in the development of educational tools, language translation
services, and data analysis projects, among others.
6. Automated Content Creation: Content creators and researchers can leverage the
API to programmatically generate content summaries, extract data for analysis,
and automate the generation of reports or articles.

14
PROJECT CODE

import java.awt.*;
import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;
import java.io.*;
import java.net.*;

import java.util.Scanner;
import javax.imageio.ImageIO;
import javax.swing.*;

import javax.swing.border.EmptyBorder;

public class SearchEngineGUI {

public static String wikipediaSearch(String query) throws IOException {


final String baseURL = "https://en.wikipedia.org/w/api.php";

URL url = new URL(baseURL +


"?action=query&format=json&prop=extracts&titles=" + query);

HttpURLConnection connection = (HttpURLConnection) url.openConnection();


connection.setRequestMethod("GET");
connection.connect();

int responseCode = connection.getResponseCode();

15
if (responseCode != 200) {

throw new IOException("Failed to connect to Wikipedia: " + responseCode);


}

Scanner isc = new Scanner(new


InputStreamReader(connection.getInputStream()));

String response = isc.nextLine();

response = response.replaceAll("<.*?>", "");


response = response.replace("\\n", "");
response = response.replace("\\", "");

int i = 307 + (query.length()*2);


int count = 0;
while(response.charAt(i) != '\"') {
count++;
i++;
}

int beginIndex = 349 + (query.length()*3) + (count*2);


int endIndex = 1200;
try {
response = response.substring(beginIndex, endIndex) + "...\nRead More at
wikipedia.com";

16
} catch(Exception e) {

response = response.substring(beginIndex, response.length()-5);


}
return response;

public static void main(String[] args) {

JFrame Jf = new JFrame("Search Engine");


ImageIcon img = new ImageIcon("background.jpeg");
JLabel background = new JLabel("", img, 0);
background.setSize(750, 500);
Jf.add(background);

JLabel titleLbl = new JLabel("Search Engine");


titleLbl.setBounds(200, 135, 400, 60);
titleLbl.setFont(new Font("Arial", Font.BOLD, 48));

titleLbl.setForeground(new Color(219, 219, 219));


background.add(titleLbl);

JTextField inputBox = new JTextField();


inputBox.setBounds(160, 220, 330, 40);
inputBox.setFont(new Font("Arial", 0, 16));
inputBox.setBorder(new EmptyBorder(10, 10, 10, 10));

17
inputBox.setBorder(null);

background.add(inputBox);

JButton searchBtn = new JButton("Search");

searchBtn.setBounds(510, 220, 100, 40);


searchBtn.setFont(new Font("Arial", 0, 18));
searchBtn.setForeground(Color.BLACK);

searchBtn.setBackground(new Color(219, 219, 219));


searchBtn.setBorder(null);
background.add(searchBtn);

JTextArea searchResult = new JTextArea();


searchResult.setFont(new Font("Arial", 0, 18));
searchResult.setLineWrap(true);
searchResult.setBounds(50, 90, 650, 340);
searchResult.setMargin(new Insets(15, 15, 15, 15));

searchResult.setVisible(false);
searchResult.setBackground(new Color(219, 219, 219));
background.add(searchResult);

searchBtn.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {

18
titleLbl.setBounds(20, 20, 200, 40);

titleLbl.setFont(new Font("Arial", Font.BOLD, 24));

inputBox.setBounds(210, 20, 350, 40);

inputBox.setMargin(new Insets(10, 10, 10, 10));


searchBtn.setBounds(580, 20, 100, 40);

searchResult.setVisible(true);
String response;
try {
response = wikipediaSearch(inputBox.getText());
searchResult.setText(response);
} catch (IOException e1) {}
}
});

Jf.setLayout(null);
Jf.setSize(750, 500);
Jf.setVisible(true);
Jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

19
PROJECT OUTPUT

20
21
REFERENCES

1. https://www.geeksforgeeks.org/introduction-to-java-swing/
2. https://www.mediawiki.org/wiki/API:Main_page
3. https://www.javatpoint.com/java-swing
4. https://docs.oracle.com/javase/tutorial/uiswing/
5. https://www.codingninjas.com/studio/library/swing-components-in-java
6. https://www.tutorialspoint.com/swing/index.htm

22

You might also like