Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1597)

Unified Diff: google.patch

Issue 12328121: Use up to 8 affixes in Hunspell spellcheck suggestions (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/hunspell.git@master
Patch Set: Address comments Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « README.chromium ('k') | src/hunspell/suggestmgr.cxx » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google.patch
diff --git a/google.patch b/google.patch
index 55b726bc51556a27c8c7f41440e3d16825d7ae82..d0fe969d94408d0e29af87fbfbe59696273f8f40 100644
--- a/google.patch
+++ b/google.patch
@@ -4,7 +4,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affixmgr.cxx,v
retrieving revision 1.41
diff -u -r1.41 affixmgr.cxx
--- src/hunspell/affixmgr.cxx 16 Dec 2011 09:15:34 -0000 1.41
-+++ src/hunspell/affixmgr.cxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/affixmgr.cxx 27 Feb 2013 01:10:35 -0000
@@ -14,8 +14,14 @@
#include "csutil.hxx"
@@ -195,7 +195,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affixmgr.hxx,v
retrieving revision 1.15
diff -u -r1.15 affixmgr.hxx
--- src/hunspell/affixmgr.hxx 13 Oct 2011 13:41:54 -0000 1.15
-+++ src/hunspell/affixmgr.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/affixmgr.hxx 27 Feb 2013 01:10:35 -0000
@@ -18,6 +18,40 @@
class PfxEntry;
class SfxEntry;
@@ -280,7 +280,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/filemgr.cxx,v
retrieving revision 1.5
diff -u -r1.5 filemgr.cxx
--- src/hunspell/filemgr.cxx 23 Jun 2011 09:21:50 -0000 1.5
-+++ src/hunspell/filemgr.cxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/filemgr.cxx 27 Feb 2013 01:10:35 -0000
@@ -7,6 +7,32 @@
#include "filemgr.hxx"
@@ -325,7 +325,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/filemgr.hxx,v
retrieving revision 1.3
diff -u -r1.3 filemgr.hxx
--- src/hunspell/filemgr.hxx 15 Apr 2010 11:22:08 -0000 1.3
-+++ src/hunspell/filemgr.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/filemgr.hxx 27 Feb 2013 01:10:35 -0000
@@ -7,6 +7,30 @@
#include "hunzip.hxx"
#include <stdio.h>
@@ -368,7 +368,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hashmgr.cxx,v
retrieving revision 1.12
diff -u -r1.12 hashmgr.cxx
--- src/hunspell/hashmgr.cxx 23 Jun 2011 09:21:50 -0000 1.12
-+++ src/hunspell/hashmgr.cxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/hashmgr.cxx 27 Feb 2013 01:10:35 -0000
@@ -12,8 +12,14 @@
// build a hash table from a munched word list
@@ -738,7 +738,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hashmgr.hxx,v
retrieving revision 1.3
diff -u -r1.3 hashmgr.hxx
--- src/hunspell/hashmgr.hxx 15 Apr 2010 11:22:08 -0000 1.3
-+++ src/hunspell/hashmgr.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/hashmgr.hxx 27 Feb 2013 01:10:35 -0000
@@ -8,10 +8,25 @@
#include "htypes.hxx"
#include "filemgr.hxx"
@@ -836,7 +836,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/htypes.hxx,v
retrieving revision 1.3
diff -u -r1.3 htypes.hxx
--- src/hunspell/htypes.hxx 6 Sep 2010 07:58:53 -0000 1.3
-+++ src/hunspell/htypes.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/htypes.hxx 27 Feb 2013 01:10:35 -0000
@@ -1,6 +1,16 @@
#ifndef _HTYPES_HXX_
#define _HTYPES_HXX_
@@ -860,7 +860,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.cxx,v
retrieving revision 1.29
diff -u -r1.29 hunspell.cxx
--- src/hunspell/hunspell.cxx 23 Jun 2011 09:21:50 -0000 1.29
-+++ src/hunspell/hunspell.cxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/hunspell.cxx 27 Feb 2013 01:10:35 -0000
@@ -7,20 +7,37 @@
#include "hunspell.hxx"
@@ -1006,7 +1006,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.hxx,v
retrieving revision 1.6
diff -u -r1.6 hunspell.hxx
--- src/hunspell/hunspell.hxx 21 Jan 2011 17:30:41 -0000 1.6
-+++ src/hunspell/hunspell.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/hunspell.hxx 27 Feb 2013 01:10:35 -0000
@@ -5,6 +5,10 @@
#include "suggestmgr.hxx"
#include "langnum.hxx"
@@ -1063,7 +1063,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/replist.hxx,v
retrieving revision 1.2
diff -u -r1.2 replist.hxx
--- src/hunspell/replist.hxx 15 Apr 2010 11:22:09 -0000 1.2
-+++ src/hunspell/replist.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/replist.hxx 27 Feb 2013 01:10:35 -0000
@@ -2,6 +2,12 @@
#ifndef _REPLIST_HXX_
#define _REPLIST_HXX_
@@ -1083,8 +1083,8 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/suggestmgr.cxx,v
retrieving revision 1.24
diff -u -r1.24 suggestmgr.cxx
--- src/hunspell/suggestmgr.cxx 14 Feb 2011 21:47:24 -0000 1.24
-+++ src/hunspell/suggestmgr.cxx 8 Jan 2013 00:30:26 -0000
-@@ -12,9 +12,110 @@
++++ src/hunspell/suggestmgr.cxx 27 Feb 2013 01:10:36 -0000
+@@ -12,9 +12,114 @@
const w_char W_VLINE = { '\0', '|' };
@@ -1130,24 +1130,25 @@ diff -u -r1.24 suggestmgr.cxx
+ // it can store affix flags into 'h->astr[0]',...,'h->astr[alen-1]'. To handle
+ // this new hentry struct, we define a struct which combines three values: an
+ // hentry struct 'hentry'; a char array 'word[kMaxWordLen]', and; an unsigned
-+ // short value 'astr' so a hentry struct 'h' returned from
++ // short array 'astr' so a hentry struct 'h' returned from
+ // CreateScopedHashEntry() satisfies the following equations:
+ // hentry* h = factory.CreateScopedHashEntry(0, source);
+ // h->word[0] == ((HashEntryItem*)h)->entry.word[0].
+ // h->word[1] == ((HashEntryItem*)h)->word[0].
+ // ...
+ // h->word[h->blen] == ((HashEntryItem*)h)->word[h->blen-1].
-+ // h->astr[0] == ((HashEntryItem*)h)->astr.
-+ // Our BDICT does not use affix flags longer than one for now since they are
-+ // discarded by convert_dict, i.e. 'h->astr' is always <= 1. Therefore, this
-+ // struct does not use an array for 'astr'.
++ // h->astr[0] == ((HashEntryItem*)h)->astr[0].
++ // h->astr[1] == ((HashEntryItem*)h)->astr[1].
++ // ...
++ // h->astr[h->alen-1] == ((HashEntryItem*)h)->astr[h->alen-1].
+ enum {
+ kMaxWordLen = 128,
++ kMaxAffixLen = 8,
+ };
+ struct HashEntryItem {
+ hentry entry;
+ char word[kMaxWordLen];
-+ unsigned short astr;
++ unsigned short astr[kMaxAffixLen];
+ };
+
+ HashEntryItem hash_items_[MAX_ROOTS];
@@ -1162,7 +1163,7 @@ diff -u -r1.24 suggestmgr.cxx
+
+hentry* ScopedHashEntryFactory::CreateScopedHashEntry(int index,
+ const hentry* source) {
-+ if (index >= MAX_ROOTS || source->blen >= kMaxWordLen || source->alen > 1)
++ if (index >= MAX_ROOTS || source->blen >= kMaxWordLen)
+ return NULL;
+
+ // Retrieve a HashEntryItem struct from our spool, initialize it, and
@@ -1171,8 +1172,11 @@ diff -u -r1.24 suggestmgr.cxx
+ HashEntryItem* hash_item = &hash_items_[index];
+ memcpy(&hash_item->entry, source, source_size);
+ if (source->astr) {
-+ hash_item->astr = *source->astr;
-+ hash_item->entry.astr = &hash_item->astr;
++ hash_item->entry.alen = source->alen;
++ if (hash_item->entry.alen > kMaxAffixLen)
++ hash_item->entry.alen = kMaxAffixLen;
++ memcpy(hash_item->astr, source->astr, hash_item->entry.alen * sizeof(hash_item->astr[0]));
++ hash_item->entry.astr = &hash_item->astr[0];
+ }
+ return &hash_item->entry;
+}
@@ -1195,7 +1199,7 @@ diff -u -r1.24 suggestmgr.cxx
// register affix manager and check in string of chars to
// try when building candidate suggestions
-@@ -407,6 +508,49 @@
+@@ -407,6 +512,49 @@
int lenr, lenp;
int wl = strlen(word);
if (wl < 2 || ! pAMgr) return ns;
@@ -1245,7 +1249,7 @@ diff -u -r1.24 suggestmgr.cxx
int numrep = pAMgr->get_numrep();
struct replentry* reptable = pAMgr->get_reptable();
if (reptable==NULL) return ns;
-@@ -448,6 +592,7 @@
+@@ -448,6 +596,7 @@
r++; // search for the next letter
}
}
@@ -1253,7 +1257,7 @@ diff -u -r1.24 suggestmgr.cxx
return ns;
}
-@@ -678,7 +823,9 @@
+@@ -678,7 +827,9 @@
// error is missing a letter it needs
int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsuggest)
{
@@ -1264,7 +1268,7 @@ diff -u -r1.24 suggestmgr.cxx
char * p;
clock_t timelimit = clock();
int timer = MINTIMER;
-@@ -700,8 +847,10 @@
+@@ -700,8 +851,10 @@
// error is missing a letter it needs
int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
{
@@ -1277,7 +1281,7 @@ diff -u -r1.24 suggestmgr.cxx
w_char * p;
clock_t timelimit = clock();
int timer = MINTIMER;
-@@ -1057,6 +1206,9 @@
+@@ -1057,6 +1210,9 @@
struct hentry* hp = NULL;
int col = -1;
@@ -1287,7 +1291,7 @@ diff -u -r1.24 suggestmgr.cxx
phonetable * ph = (pAMgr) ? pAMgr->get_phonetable() : NULL;
char target[MAXSWUTF8L];
char candidate[MAXSWUTF8L];
-@@ -1115,7 +1267,11 @@
+@@ -1115,7 +1271,11 @@
if (sc > scores[lp]) {
scores[lp] = sc;
@@ -1305,7 +1309,7 @@ RCS file: /cvsroot/hunspell/hunspell/src/hunspell/suggestmgr.hxx,v
retrieving revision 1.5
diff -u -r1.5 suggestmgr.hxx
--- src/hunspell/suggestmgr.hxx 21 Jan 2011 22:10:24 -0000 1.5
-+++ src/hunspell/suggestmgr.hxx 8 Jan 2013 00:30:26 -0000
++++ src/hunspell/suggestmgr.hxx 27 Feb 2013 01:10:36 -0000
@@ -52,7 +52,11 @@
« no previous file with comments | « README.chromium ('k') | src/hunspell/suggestmgr.cxx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698