lib/natural/distance/levenshtein_distance.js
function _getMatchStart(distanceMatrix, matchEnd, sourceLength) {
  var row = sourceLength;
  var column = matchEnd;
  var tmpRow;
  var tmpColumn;

  // match will be empty string
  if (matchEnd === 0) { return 0; }

  while(row > 1 && column > 1) {
   tmpRow = row;
   tmpColumn = column;
   row = distanceMatrix[tmpRow][tmpColumn].parentCell.row;
   column = distanceMatrix[tmpRow][tmpColumn].parentCell.column;
  }

  return column-1;
}
function _getMatchStart(distanceMatrix, matchEnd, sourceLength) {
  var row = sourceLength;
  var column = matchEnd;
  var tmpRow;
  var tmpColumn;

  // match will be empty string
  if (matchEnd === 0) { return 0; }

  while(row > 1 && column > 1) {
   tmpRow = row;
   tmpColumn = column;
   row = distanceMatrix[tmpRow][tmpColumn].parentCell.row;
   column = distanceMatrix[tmpRow][tmpColumn].parentCell.column;
  }

  return column-1;
}
function _getMatchStart ( distanceMatrix , matchEnd , sourceLength ) { var row = sourceLength ; var column = matchEnd ; var tmpRow ; var tmpColumn ; // match will be empty string if ( matchEnd === 0 ) { return 0 ; } while ( row > 1 && column > 1 ) { tmpRow = row ; tmpColumn = column ; row = distanceMatrix [ tmpRow ] [ tmpColumn ] . parentCell . row ; column = distanceMatrix [ tmpRow ] [ tmpColumn ] . parentCell . column ; } return column - 1 ; }
Walk the path back from the matchEnd to the beginning of the match. Do this by traversing the distanceMatrix as you would a linked list, following going from cell child to parent until reach row 0.
Walk the path back from the matchEnd to the beginning of the match . Do this by traversing the distanceMatrix as you would a linked list following going from cell child to parent until reach row 0 .