private static Distance<Contact> getDistance() {
		Distance<Contact> bm_distance = new Distance<Contact>(){
			@Override
			public double distance(Contact c0, Contact c1) {

				Set<String> langs0 = getLanguages(c0);
				Set<String> langs1 = getLanguages(c1);				
				
				if(langs0.isEmpty() || langs1.isEmpty()) return 40.0;
				
				Set<String> intersection = intersection(c0, c1);
				
				if(intersection.isEmpty()) return 40.0;
				
				//System.out.println(""+(langs0.size()+langs1.size())/intersection.size());
				
				return (langs0.size()+langs1.size())/intersection.size();

			}

			private Set<String> intersection(Contact c0, Contact c1) {
				Set<String> langs0 = getLanguages(c0);
				Set<String> langs1 = getLanguages(c1);
				
				Set<String> intersection = new HashSet<String>();
				
				for(String s : langs0) 
					if(langs1.contains(s)) 
						intersection.add(s);
				
				return intersection;
			}
			
		};
		return bm_distance;
	}