lib/distance/dice.js
function dice( source, target ) {
  
  var sources = dice.prepare( source )
  var targets = dice.prepare( target )
  
  var i, k, intersection = 0
  var source_count = sources.length
  var target_count = targets.length
  var union = source_count + target_count
  
  for( i = 0; i < source_count; i++ ) {
    source = sources[i]
    for( k = 0; k < target_count; k++ ) {
      target = targets[k]
      if( source === target ) {
        intersection++
        targets[k] = undefined
        break
      }
    }
  }
  
  return 2 * intersection / union
  
}
function dice( source, target ) {
  
  var sources = dice.prepare( source )
  var targets = dice.prepare( target )
  
  var i, k, intersection = 0
  var source_count = sources.length
  var target_count = targets.length
  var union = source_count + target_count
  
  for( i = 0; i < source_count; i++ ) {
    source = sources[i]
    for( k = 0; k < target_count; k++ ) {
      target = targets[k]
      if( source === target ) {
        intersection++
        targets[k] = undefined
        break
      }
    }
  }
  
  return 2 * intersection / union
  
}
function dice ( source , target ) { var sources = dice . prepare ( source ) var targets = dice . prepare ( target ) var i , k , intersection = 0 var source_count = sources . length var target_count = targets . length var union = source_count + target_count for ( i = 0 ; i < source_count ; i ++ ) { source = sources [ i ] for ( k = 0 ; k < target_count ; k ++ ) { target = targets [ k ] if ( source === target ) { intersection ++ targets [ k ] = undefined break } } } return 2 * intersection / union }
Computes dice's coefficient.

@param  {String} source
@param  {String} target
@return {Number} dice coefficient
Computes dice s coefficient .