Skip to content

Commit

Permalink
[de] support more than one suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnaber committed May 10, 2019
1 parent 1fbab47 commit 11dac8a
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -32,6 +32,7 @@
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Scanner; import java.util.Scanner;


Expand All @@ -53,15 +54,15 @@ class SpellingData {
continue; continue;
} }
String[] parts = line.split(";"); String[] parts = line.split(";");
if (parts.length != 2) { if (parts.length < 2) {
throw new RuntimeException("Unexpected format in file " + filePath + ": " + line); throw new RuntimeException("Unexpected format in file " + filePath + ": " + line);
} }
String alternative = parts[0]; String alternative = parts[0];
String suggestion = parts[1]; List<String> suggestions = new ArrayList<>(Arrays.asList(parts).subList(1, parts.length));
List<PatternToken> patternTokens = getTokens(alternative, german); List<PatternToken> patternTokens = getTokens(alternative, german);
PatternRule rule = new PatternRule(ruleId, german, patternTokens, ruleDesc, message, shortMessage); PatternRule rule = new PatternRule(ruleId, german, patternTokens, ruleDesc, message, shortMessage);
rule.setLocQualityIssueType(issueType); rule.setLocQualityIssueType(issueType);
spellingRules.add(new SpellingRuleWithSuggestions(rule, alternative, suggestion)); spellingRules.add(new SpellingRuleWithSuggestions(rule, alternative, suggestions));
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
Expand Down

0 comments on commit 11dac8a

Please sign in to comment.