(String s, String t)
| 192 | for our doc distance, I think it's ok to measure as same |
| 193 | */ |
| 194 | public static int whitespaceEditDistance(String s, String t) { |
| 195 | int s_spaces = Tool.count(s, ' '); |
| 196 | int s_nls = Tool.count(s, '\n'); |
| 197 | int t_spaces = Tool.count(t, ' '); |
| 198 | int t_nls = Tool.count(t, '\n'); |
| 199 | return Math.abs(s_spaces - t_spaces) + Math.abs(s_nls - t_nls); |
| 200 | } |
| 201 | |
| 202 | /** Compute a document difference metric 0-1.0 between two documents that |
| 203 | * are identical other than (likely) the whitespace and comments. |