• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
projectsgeek

ProjectsGeek

Download Mini projects with Source Code, Java projects with Source Codes

  • Home
  • Java Projects
  • C++ Projects
  • VB Projects
  • PHP projects
  • .Net Projects
  • NodeJs Projects
  • Android Projects
    • Project Ideas
      • Final Year Project Ideas
      • JSP Projects
  • Assignment Codes
    • Fundamentals of Programming Language
    • Software Design Laboratory
    • Data Structure and Files Lab
    • Computer Graphics Lab
    • Object Oriented Programming Lab
    • Assembly Codes
  • School Projects
  • Forum

ProjectsGeek

Implementation of Single Pass Algorithm for Clustering

April 29, 2012 by ProjectsGeek 2 Comments

Implementation of Single Pass Algorithm for Clustering – BE(IT) CLP-II Practical

Aim  : To implement Single Pass Algorithm for Clustering  in Documents and Files . 
Objective : To study Clustering in files or Documents using single pass algorithm  

Given below is the Single Pass Algorithm for Clustering  with source code in Java Language . For this code to work you should have three files for sample input (Text Files ) .

Source Code for Single Pass Algorithm

 package com.prac.prac;  
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class singlepass {
public static void main(String[] args) throws IOException{
BufferedReader stdInpt = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the no of Tokens");
int noOfDocuments=Integer.parseInt(stdInpt.readLine());
System.out.println("Enter the no of Documents");
int noOfTokens=Integer.parseInt(stdInpt.readLine());
System.out.println("Enter the threshhold");
float threshhold=Float.parseFloat(stdInpt.readLine());
System.out.println("Enter the Document Token Matrix");
int [][]input= new int [noOfDocuments][noOfTokens];
for(int i=0;i {
for(int j=0;j {
System.out.println("Enter("+i+","+j+")");
input[i][j]=Integer.parseInt(stdInpt.readLine());
}
}
SinglePassAlgorithm(noOfDocuments, noOfTokens, threshhold, input);
}
private static void SinglePassAlgorithm(int noOfDocuments,int noOfTokens,float threshhold,int [][]input)
{
int [][] cluster = new int [noOfDocuments][noOfDocuments+1];
ArrayList clusterRepresentative = new ArrayList();
cluster [0][0]=1;
cluster [0][1]=0;
int noOfClusters=1;
Float []temp= new Float[noOfTokens];
temp=convertintArrToFloatArr(input[0]);
clusterRepresentative.add(temp);
for(int i=1;i {
float max=-1;
int clusterId=-1;
for(int j=0;j {
float similarity=calculateSimilarity(convertintArrToFloatArr(input[i]),clusterRepresentative.get(j) );
if(similarity>threshhold)
{
if(similarity>max)
{
max=similarity;
clusterId=j;
}
}
}
if(max==-1)
{
cluster[noOfClusters][0]=1;
cluster[noOfClusters][1]=i;
noOfClusters++;
clusterRepresentative.add(convertintArrToFloatArr(input[i]));
}
else
{
cluster[clusterId][0]+=1;
int index=cluster[clusterId][0];
cluster[clusterId][index]=i;
clusterRepresentative.set(clusterId,calculateClusterRepresentative(cluster[clusterId],input, noOfTokens));
}
}
for(int i=0;i {
System.out.print("\n"+i+"\t");
for(int j=1;j<=cluster[i][0];++j)
{
System.out.print(" "+cluster[i][j]);
}
}
}
private static Float[] convertintArrToFloatArr(int[] input)
{
int size=input.length;
Float[] answer = new Float[size];
for(int i=0;i {
answer[i]=(float)input[i];
}
return answer;
}
private static float calculateSimilarity(Float[] a,Float[] b)
{
float answer=0;
for(int i=0;i {
answer+=a[i]*b[i];
}
return answer;
}
private static Float[] calculateClusterRepresentative(int[] cluster,int [][] input,int noOFTokens)
{
Float[] answer= new Float[noOFTokens];
for(int i=0;i {
answer[i]=Float.parseFloat("0");
}
for(int i=1;i<=cluster[0];++i)
{
for(int j=0;j {
answer[j]+=input[cluster[i]][j];
}
}
for(int i=0;i {
answer[i]/=cluster[0];
}
return answer;
}
}

Output of Single Pass Algorithm

Enter the no of Tokens

5
Enter the no of Documents
5
Enter the threshhold
10
Enter the Document Token Matrix
Enter(0,0)
1
Enter(0,1)
3
Enter(0,2)
3
Enter(0,3)
2
Enter(0,4)
2
Enter(1,0)
2
Enter(1,1)
1
Enter(1,2)
0
Enter(1,3)
1
Enter(1,4)
2
Enter(2,0)
0
Enter(2,1)
2
Enter(2,2)
0
Enter(2,3)
0
Enter(2,4)
1
Enter(3,0)
0
Enter(3,1)
3
Enter(3,2)
1
Enter(3,3)
0
Enter(3,4)
5
Enter(4,0)
1
Enter(4,1)
0
Enter(4,2)
1
Enter(4,3)
0
Enter(4,4)
1

0 0 1 3
1 2
2 4

Other Projects to Try:

  1. To Implement a Program Retrieval of Documents using Inverted Files
  2. Implement using Socket Programming (TCP/UDP) in Java
  3. To Perform various String Operation in Java
  4. Database connectivity in Java with MYSQL
  5. Kruskal’s Algorithm , Prims Algorithm

Filed Under: CLP-II

To Implement a Program Retrieval of Documents using Inverted Files

April 29, 2012 by ProjectsGeek Leave a Comment

Retrieval of Documents using Inverted Files -BE(IT) CLP-II Practical

Aim  : To implement a program Retrieval of documents using inverted files. 
Objective : To study Indexing , Inverted Files and searching with the help of inverted file  in Java Language . Code written in Java to implement of the same with appropriate output. 

Input to the Program of Inverted Files :

File 1 Contents :  are you anil kumar

File 2 Contents : hello where are you.

Source Code for Inverted Files in Java Language :

package com.prac.prac;  
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class invertedfile
{
public static void displayIndex(ArrayList invertedData,int[][] docno){
int i,j;
for(i=0;i System.out.print(invertedData.get(i)+"\t");
for(j=1;j<=docno[i][0];j++)
System.out.print(docno[i][j]+"\t");
System.out.print("\n");
}
}
public static void indexing(String fname,ArrayList invertedData,int[][] docno,int fileno)
{
BufferedReader br;
try
{
br = new BufferedReader(new FileReader(fname));
String data = "", line = br.readLine();
while(line!=null)
{
data+=line+" ";
line=br.readLine();
}
String[] st=data.split("[ ,.]");
String currenttoken=null;
int i=0;
while(i {
currenttoken=st[i];
int indx=invertedData.indexOf(currenttoken);
if (indx==-1)
{
invertedData.add(currenttoken);
indx=invertedData.indexOf(currenttoken);
docno[indx][0]=1;
docno[indx][1]=fileno;
}
else
{
docno[indx][docno[indx][0]+1]=fileno;
docno[indx][0]+=1;
}
i+=1;
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args) throws NumberFormatException, IOException {
String fname="";
ArrayList invertedData=new ArrayList();
int docno[][]=new int[100][10];
InputStreamReader ins=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(ins);
System.out.println("\nENTER TOTAL NO OF FILES:");
int no=Integer.parseInt(br.readLine());
int i=1;
while(i-1!=no)
{
System.out.println("\nENTER FILE "+i+" NAME:");
fname=br.readLine();
indexing(fname,invertedData,docno,i);
i+=1;
}
displayIndex(invertedData,docno);
}
}

Output for the Inverted Files Program:



ENTER TOTAL NO OF FILES:
2


ENTER FILE 1 NAME:
c:\anil1.txt


ENTER FILE 2 NAME:
c:\anil2.txt


hello 1
where 1
are 1 2
you 1 2
anil 2
kumar 2

Other Projects to Try:

  1. Multiple Inheritance in java program
  2. Implementation of Single Pass Algorithm for Clustering
  3. Data Structure and Files Program Codes
  4. Implement a Program for Feature Extraction in 2D Colour Images (any features like Colour, Texture etc.)
  5. Implement using Socket Programming (TCP/UDP) in Java

Filed Under: CLP-II

Implement Conflation Algorithm using File Handling in Java

April 27, 2012 by ProjectsGeek Leave a Comment

Aim : To implement Conflation Algorithm using File Handling. 


package com.prac.prac;  
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class conflation {
/**
* @param args
*/
public static void main(String[] args) {
InputStreamReader st = new InputStreamReader(System.in);
BufferedReader buff = new BufferedReader(st);
String fname="";
System.out.println("Enter File Name :");
try {
fname = buff.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
conflation(fname);
}
private static void conflation(String fname)
{
BufferedReader buff;
try {
buff = new BufferedReader(new FileReader(fname));
String line="", data="" ;
line = buff.readLine();
while(line!=null)
{
data+=line ;
System.out.println(line);
line=buff.readLine();
}
Pattern pattern= Pattern.compile("(ed,ing)|\\b(this |is |a |and |are |an |the)",Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(data);
String clean = matcher.replaceAll("");
StringTokenizer st = new StringTokenizer(clean);
String currenttoken = "" ;
ArrayList token = new ArrayList() ;
ArrayList count = new ArrayList() ;
while(st.hasMoreTokens())
{
currenttoken = st.nextToken() ;
int index = token.indexOf(currenttoken);
if(index!=-1)
{
count.set(index,count.get(index+1 )); }
else
{
token.add(currenttoken);
count.add(1);
}
}
System.out.println("OUTPUT IS:\nTOKENS\tNO OF OCCURENCES");
for(int i=0;i System.out.println(token.get(i)+"\t"+count.get(i));
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

Other Projects to Try:

  1. To Implement a Program Retrieval of Documents using Inverted Files
  2. File Handling and IO Handling in Java Programming
  3. To Perform File Handling in Java
  4. File Handling program using Java
  5. Implement using Socket Programming (TCP/UDP) in Java

Filed Under: CLP-II

To Implement Web Crawler in Java BE(IT) CLP-II Pratical

April 27, 2012 by ProjectsGeek Leave a Comment

To Implement Web Crawler in Java BE(IT) CLP-II Pratical

Aim  : To implement Web Crawler in Java Language .


Web crawler is the program of piece of code that search engine uses to index Web pages across the web. It crawls the HTML Page to find the keywords on that page for search engine indexing of the pages .


Below code Web crawler in Java crawls the “google.com” and finds out the total links to other pages . 

 import java.net.*;  
import java.io.*;
import java.util.regex.*;
public class crawler {
public static void main(String[] args) {
String source_url="https://google.com";
try
{
URL url = new URL(source_url);
URLConnection yc = url.openConnection();
String data=null;
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
data=data+inputLine ;
in.close();
Integer i=0;
Pattern pattern = Pattern.compile("]*href=\"[^>]*>(.*?)");
Matcher matcher = pattern.matcher(data);
while (matcher.find())
{
System.out.println((i+1)+ matcher.group());
i=i+1;
}
System.out.println("TOTAL LINKS:"+i);
}
catch(Exception e)
{
System.out.println(e);
}
}
}

Other Projects to Try:

  1. Implement Conflation Algorithm using File Handling in Java
  2. Implement using Socket Programming (TCP/UDP) in Java
  3. To Implement a Program Retrieval of Documents using Inverted Files
  4. Wiki Page Ranking With Hadoop Project
  5. Search Engine project in Java

Filed Under: CLP-II

Java Programming from program analysis to program Design By -DS Malik

April 22, 2012 by ProjectsGeek Leave a Comment

Java Programming from program analysis to program Design By -DS Malik
 
 
Java Programming from program analysis to program Design By -DS Malik 1
Java Programming
 
Java Programming from program analysis to program Design is best for learning Java for Computer science engineering students . Book have very good cure for learning java with good examples and codes .
Book features are lot’s of examples and sample codes which can help in making good concepts in Java programming .
Download E-Book from Below Link :
Java Programming.zip
Size : 2642k

Other Projects to Try:

  1. Java for Programmers By -Paul Dietel and Harvey Dietel
  2. Socket programming in Java
  3. Implement using Socket Programming (TCP/UDP) in Java
  4. Java How to Program By – Paul Deitel and Harvey Deitel
  5. First Program in Java

Filed Under: E-Books

Java for Programmers By -Paul Dietel and Harvey Dietel

April 22, 2012 by ProjectsGeek Leave a Comment

Java for Programmers By -Paul Dietel and Harvey Dietel 

Java for Programmers By -Paul Dietel and Harvey Dietel 2
Java for Programmers


Java for Programmers has lot’s of full Java program with huge lines of Java code for good concept Building . It also have hundreds of tips that will help you build powerful applications in Java .Book  Begins  with an introduction to using Java classes and early objects approach  to more advanced topics,like ……
  1. GUI, 
  2. graphics
  3. exception handling
  4. generics
  5. collections 
  6. JDBC

 Book also covers Developing web applications with Java Server .
 It is Equipped with  everything you need to build an object-oriented Java applications. 

You can find lot’s of examples on  Practical , example-rich coverage : 
  • Java SE 7Classes
  • Objects
  • Encapsulation
  •  Inheritance
  •  Polymorphism
Download E-Book from Below Link :

Java for Programmers.Zip
Size:15005k


Other Projects to Try:

  1. Java How to Program By – Paul Deitel and Harvey Deitel
  2. Java Programming from program analysis to program Design By -DS Malik
  3. Java Tutorial for beginners – Introduction to Java
  4. Java Programs
  5. Introduction to Java

Filed Under: E-Books

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 100
  • Page 101
  • Page 102
  • Page 103
  • Page 104
  • Interim pages omitted …
  • Page 135
  • Go to Next Page »

Primary Sidebar

Tags

.Net Projects Download Android Project Ideas Android Projects Angular 2 Assembly Codes C # Projects C & C++ Projects C++ Projects Class Diagrams Computer Graphics Database Project Data Mining Projects DataScience Projects Datastructure Assignments Download Visual Basic Projects Electronics project Hadoop Projects Installation Guides Internet of Things Project IOS Projects Java Java Interview Questions Java Projects JavaScript JavaScript Projects java tutorial JSON JSP Projects Mechanical Projects Mongodb Networking Projects Node JS Projects OS Problems php Projects Placement Papers Project Ideas Python Projects seminar and presentation Struts

Search this Website


Footer

Download Java Project
Download Visual Basic Projects
Download .Net Projects
Download VB Projects
Download C++ Projects
Download NodeJs Projects
Download School Projects
Download School Projects
Ask Questions - Forum
Latest Projects Ideas
Assembly Codes
Datastructure Assignments
Computer Graphics Lab
Operating system Lab
australia-and-India-flag
  • Home
  • About me
  • Contact Form
  • Submit Your Work
  • Site Map
  • Privacy Policy