/// <summary> /// Instantiates an edit distance computer with the specified similarity /// computation function and the specified insert/delete and move costs. Note /// that no move operations are computed unless ComputeMoveOperations is set to /// true (the default is false). /// </summary> /// <param name="similarityComputer">The item similarity computation method</param> /// <param name="insertDeleteCosts">The costs of inserting/deleting an item</param> /// <param name="moveCosts">The costs of moving an item. If >0, move operations will /// be computed. Otherwise, no move operations will be computed. Move costs should be /// between the insertion/deletion costs and two times the insertion/deletion costs.</param> public EditDistanceComputer(SimilarityComputer <T> similarityComputer, double insertDeleteCosts, double moveCosts) { _SimilarityComputer = similarityComputer; if (insertDeleteCosts < 0.0d) { throw new ArgumentOutOfRangeException("Insert/delete costs must be larger than 0"); } if (moveCosts < 0.0d) { throw new ArgumentOutOfRangeException("Move costs must be larger than 0"); } _InsertDeleteCosts = insertDeleteCosts; _MoveCosts = moveCosts; _SimThreshold = 0.85d; _ComputeMoveOperations = (moveCosts > 0.0d); }
/// <summary> /// Instantiates an edit distance computer with the specified similarity /// computation function and the default insert/delete (1.0) costs, change /// costs of 0.9, and zero move (0.0) costs (the latter meaning that no /// move operations are computed). /// </summary> /// <param name="similarityComputer">The item similarity computation method</param> public EditDistanceComputer(SimilarityComputer <T> similarityComputer) : this(similarityComputer, 1.0d, 0.0d) { }