Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed allButTextLevelOnly mode to paragraphLevelOnly #10332

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ private void sleep(Random rnd) {
private void check(String doc, Stats stats, boolean checkCompleteText) {
try {
if (checkCompleteText) {
checkByPOST(doc, "allButTextLevelOnly", stats);
checkByPOST(doc, "paragraphLevelOnly", stats);
} else {
String[] paras = doc.split("\n\n");
String lastPara = paras[paras.length-1];
//if (!lastPara.equals(doc)) {
// System.out.println("doc/last: " + doc.length() + " / " + lastPara.length() + ": " + lastPara);
//}
checkByPOST(lastPara, "allButTextLevelOnly", stats);
checkByPOST(lastPara, "paragraphLevelOnly", stats);
}
checkByPOST(doc, "textLevelOnly", stats);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ List<RuleMatch> check(String text, ParagraphHandling paraMode, RemoteCheck check
configBuilder.enabledRuleIds(tmpEnabled.toArray(new String[0]));
configBuilder.enabledOnly();
}
configBuilder.mode("allButTextLevelOnly");
configBuilder.mode("paragraphLevelOnly");
}
}
configBuilder.level("default");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ static Mode getMode(Map<String, String> params) {
String modeParam = params.get("mode");
if ("textLevelOnly".equals(modeParam)) {
mode = Mode.TEXTLEVEL_ONLY;
} else if ("allButTextLevelOnly".equals(modeParam)) {
} else if ("paragraphLevelOnly".equals(modeParam)) {
mode = Mode.ALL_BUT_TEXTLEVEL_ONLY;
} else if ("all".equals(modeParam)) {
mode = Mode.ALL;
} else if ("batch".equals(modeParam)) {
// used in undocumented API for /words/add, /words/delete; ignore
mode = Mode.ALL;
} else {
throw new BadRequestException("Mode must be one of 'textLevelOnly', 'allButTextLevelOnly', or 'all' but was: '" + modeParam + "'");
throw new BadRequestException("Mode must be one of 'textLevelOnly', 'paragraphLevelOnly', or 'all' but was: '" + modeParam + "'");
}
} else {
mode = Mode.ALL;
Expand Down
2 changes: 1 addition & 1 deletion languagetool-standalone/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ and Russian.
* New setting `fasttextModel` (see https://fasttext.cc/docs/en/language-identification.html)
and `fasttextBinary` (see https://fasttext.cc/docs/en/support.html). With these
options set, the automatic language detection is much better than the built-in one.
* Experimental new `mode` parameter with `all`, `textLevelOnly`, or `allButTextLevelOnly` as value:
* Experimental new `mode` parameter with `all`, `textLevelOnly`, or `paragraphLevelOnly` as value:
Will check only text-level rules or all other rules. As there are fewer text-level rules,
this is usually much faster and the access limit for characters per minute that can be
checked is more generous for this mode.
Expand Down