public void addTweet(Status s, String NERloc, String regLoc, String category, double confidence)
	{
		//Extract URL entities from the tweet
		URLEntity[] urls = s.getURLEntities();
		String urlStr = handleURL(urls);
		
		//Extract hash tags from tweet
		HashtagEntity[] htes=s.getHashtagEntities();
		String hts = handleHashTags(htes);

		int mulloc = 0;
		double lat=Double.MAX_VALUE,lon=Double.MAX_VALUE;
		Place p;
		//If geo location is not null, get tweet coordinates from that
		if(s.getGeoLocation() != null)
		{
			lat = s.getGeoLocation().getLatitude();
			lon = s.getGeoLocation().getLongitude();
		}
		//Else get tweet coordinates from Place
		else if((p = s.getPlace()) != null)
		{
			if (p.getBoundingBoxCoordinates()!=null) 
			{
                GeoLocation[][] box = p.getBoundingBoxCoordinates();    
                for (int i = 0;i < box.length; i++) {
                        for (int j = 0;j < box[0].length; j++) {
                                lat += box[i][j].getLatitude();
                                lon += box[i][j].getLongitude();
                        }       
                }
                lat = lat/4;
                lon = lon/4;
                
			}
			else if (p.getGeometryCoordinates() != null) {
	                GeoLocation[][] box = p.getGeometryCoordinates();       
	                for (int i = 0;i < box.length; i++) {
	                        for (int j = 0;j < box[0].length; j++) {
	                        	lat += box[i][j].getLatitude();
                                lon += box[i][j].getLongitude();
                            }       
	                }
	                lat = lat / 4;
	                lon = lon /4;
	        }
		}
		//Else get coordinates from the location extracted by NER
		else if(NERloc != null)
		{
			double[] loc = getGPS(NERloc,true);
			lat = loc[0];
			lon = loc[1];
			mulloc = (int)loc[2];
			if (mulloc > 1)
				mulloc = 1;
			
		}
		//Else get tweet coordinates from the address matched by regular expression
		else if(regLoc != null)
		{
			double [] loc = getGPS(regLoc,true);
			lat = loc[0];
			lon = loc[1];
			mulloc = (int)loc[2];
			if(mulloc > 1)
				mulloc = 1;
		}

		try {
			tweetCommitCount++;
			PreparedStatement pstmt = con.prepareStatement(tweetdbInsert);
			
			pstmt.setLong(1, s.getUser().getId());
			pstmt.setString(2, s.getText());
			pstmt.setLong(3, s.getCreatedAt().getTime()/1000);
			pstmt.setLong(4, s.getRetweetCount());
			pstmt.setString(5, urlStr);
			pstmt.setString(6,hts);
			pstmt.setDouble(7, lat);
			pstmt.setDouble(8, lon);
			pstmt.setString(9, category);
			pstmt.setLong(10, s.getId());
			pstmt.setInt(11, mulloc);

			PreparedStatement rankstmt = con.prepareStatement(insertwithrank);
			double[] features = getFeatureVector(s,category,confidence);
			rankstmt.setLong(1,s.getId());
			double rank = 0.0;
			for(int i = 0; i < features.length; i++)
			{
					
				double val = (features[i] / maxes[i]);
				rankstmt.setDouble(i+2,val);
				rank += val * weights[i];
			}
			rankstmt.setDouble(12,rank);
			rankstmt.setDouble(13,confidence);
			rankstmt.executeUpdate();	
			rankstmt.close();
			pstmt.executeUpdate();
			pstmt.close();
			
			if(tweetCommitCount > 50)
			{
				tweetCommitCount = 0;
				con.commit();
				updateMaxes();
			}
		} catch (SQLException e) {
			System.out.println("tweets database error");
			System.out.println(Long.toString(s.getId()));
			e.printStackTrace();
		}
	}