INNER CODE UNIT · Java

numRows

robinhood/ticker · ticker/src/main/java/com/robinhood/ticker/LevenshteinUtils.java:161

        final int numRows = sourceLength + 1;
        final int numCols = targetLength + 1;

        // Compute the Levenshtein matrix
        final int[][] matrix = new int[numRows][numCols];

        for (int i = 0; i < numRows; i++) {
            matrix[i][0] = i;
        }
        for (int j = 0; j < numCols; j++) {
            matrix[0][j] = j;
        }

        int cost;
        for (int row = 1; row < numRows; row++) {
            for (int col = 1; col < numCols; col++) {
                cost = source[row - 1 + sourceStart] == target[col - 1 + targetStart] ? 0 : 1;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…