Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Jun 23, 2022
1 parent bea10d8 commit d4d1936
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/luwrain/nlp/SpellExclusion.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public void load()
{
final Gson gson = new Gson();
try {
if (!getFile().exists())
{
exclusions.clear();
return;
}
final List<Exclusion> res;
try(final BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(getFile()), "UTF-8"))) {
res = gson.fromJson(r, EXCLUSION_LIST_TYPE);
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/org/luwrain/nlp/ru/spell/Problem.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ final class Problem implements SpellProblem

Problem(RuleMatch match)
{
this.message = match.getMessage();
this.shortMessage = match.getShortMessage();
if (match.getMessage() != null)
this.message = match.getMessage().replaceAll("<suggestion>.*</suggestion>", ""); else
this.message = "";
if (match.getShortMessage() != null)
this.shortMessage = match.getShortMessage().replaceAll("<suggestion>.*</suggestion>", ""); else
this.shortMessage = "";
this.fromPos = match.getFromPos();
this.toPos = match.getToPos();
/*
List<SuggestedReplacement> repl = r.getSuggestedReplacementObjects();
for(SuggestedReplacement rr: repl)
rr;
List<SuggestedReplacement> repl = r.getSuggestedReplacementObjects();
for(SuggestedReplacement rr: repl)
rr;
*/
}

Expand Down

0 comments on commit d4d1936

Please sign in to comment.