/** * Traverses valid outward links from {@code src} node. If {@code src} equals {@code dest}, then a * score is computed. Of all possible paths from this state, the maximum score is returned. From * this state, only side directions are valid. */ private static double hsoState5(int depth, int dirChange, Synset src, Synset dest) { double bestScore = (src.equals(dest)) ? C - depth - dirChange : 0; depth++; if (depth > 5) return Math.max(bestScore, 0); for (Relation relation : SIDE_RELATION) for (Synset related : src.getRelations(relation)) bestScore = Math.max(bestScore, hsoState5(depth, dirChange, related, dest)); return bestScore; }