Skip to content
Permalink
Browse files

[Hunspell] Reduce maximum suggestions from 15 to 5.

Before this patch, the maximum number of suggestions within Hunspell
was 15, although Chrome uses only 5 suggestions.
See: https://cs.chromium.org/chromium/src/components/spellcheck/common/spellcheck_common.h?l=22&rcl=a88c5fe6e641bdc9cb84b64ddb90ead67e0d0bcc

So when a misspelled word has more than 5 suggestions, Hunspell does
a useless job and searches for suggestions that will never be used.

This patch reduces from 15 to 5 the maximum number of searched
suggestions within Hunspell.

Bug: NONE
Change-Id: I68054cfc161ec509c99a620de2b0e5252576853c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863298
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706478}
  • Loading branch information
Alexander Rezepkin Commit Bot
Alexander Rezepkin authored and Commit Bot committed Oct 16, 2019
1 parent 62057f5 commit dd0fc7c8c614c624e8c3dc2413a4b9c4c86843d3
Showing with 9 additions and 3 deletions.
  1. +1 −0 AUTHORS
  2. +7 −2 third_party/hunspell/google.patch
  3. +1 −1 third_party/hunspell/src/hunspell/hunspell.hxx
@@ -41,6 +41,7 @@ Alex Henrie <alexhenrie24@gmail.com>
Alex Scheele <alexscheele@gmail.com>
Alexander Douglas <agdoug@amazon.com>
Alexander Guettler <alexander@guettler.io>
Alexander Rezepkin <etu@vivaldi.net>
Alexander Shalamov <alexander.shalamov@intel.com>
Alexander Sulfrian <alexander@sulfrian.net>
Alexandre Abreu <wiss1976@gmail.com>
@@ -1042,7 +1042,7 @@ diff --git a/src/hunspell/hunspell.hxx b/src/hunspell/hunspell.hxx
index 43af66b..a35df83 100644
--- a/src/hunspell/hunspell.hxx
+++ b/src/hunspell/hunspell.hxx
@@ -79,6 +79,10 @@
@@ -79,9 +79,13 @@
#include <string>
#include <vector>

@@ -1052,7 +1052,12 @@ index 43af66b..a35df83 100644
+
#define SPELL_XML "<?xml?>"

#define MAXSUGGESTION 15
-#define MAXSUGGESTION 15
+#define MAXSUGGESTION 5
#define MAXSHARPS 5

#ifndef MAXWORDLEN

@@ -115,11 +119,17 @@ class LIBHUNSPELL_DLL_EXPORTED Hunspell {
* long path names (without the long path prefix Hunspell will use fopen()
* with system-dependent character encoding instead of _wfopen()).
@@ -85,7 +85,7 @@

#define SPELL_XML "<?xml?>"

#define MAXSUGGESTION 15
#define MAXSUGGESTION 5
#define MAXSHARPS 5

#ifndef MAXWORDLEN

0 comments on commit dd0fc7c

Please sign in to comment.
You can’t perform that action at this time.