comparison src/spell.c @ 633:7437be625546

updated for version 7.0183
author vimboss
date Fri, 20 Jan 2006 23:02:51 +0000
parents 84217af41926
children 593092a5362b
comparison
equal deleted inserted replaced
632:b6632d553df3 633:7437be625546
57 * Only use it for small word lists! */ 57 * Only use it for small word lists! */
58 #if 0 58 #if 0
59 # define SPELL_PRINTTREE 59 # define SPELL_PRINTTREE
60 #endif 60 #endif
61 61
62 /* Use DEBUG_TRIEWALK to print the changes made in suggest_trie_walk(). */ 62 /* Use DEBUG_TRIEWALK to print the changes made in suggest_trie_walk() for a
63 * specific word. */
63 #if 0 64 #if 0
64 # define DEBUG_TRIEWALK 65 # define DEBUG_TRIEWALK
65 #endif 66 #endif
66 67
67 /* 68 /*
326 327
327 /* for <flags2>, shifted up one byte to be used in wn_flags */ 328 /* for <flags2>, shifted up one byte to be used in wn_flags */
328 #define WF_HAS_AFF 0x0100 /* word includes affix */ 329 #define WF_HAS_AFF 0x0100 /* word includes affix */
329 #define WF_NEEDCOMP 0x0200 /* word only valid in compound */ 330 #define WF_NEEDCOMP 0x0200 /* word only valid in compound */
330 331
332 /* only used for su_badflags */
333 #define WF_MIXCAP 0x20 /* mix of upper and lower case: macaRONI */
334
331 #define WF_CAPMASK (WF_ONECAP | WF_ALLCAP | WF_KEEPCAP | WF_FIXCAP) 335 #define WF_CAPMASK (WF_ONECAP | WF_ALLCAP | WF_KEEPCAP | WF_FIXCAP)
332 336
333 /* flags for <pflags> */ 337 /* flags for <pflags> */
334 #define WFP_RARE 0x01 /* rare prefix */ 338 #define WFP_RARE 0x01 /* rare prefix */
335 #define WFP_NC 0x02 /* prefix is not combining */ 339 #define WFP_NC 0x02 /* prefix is not combining */
4326 * require three upper case letters. */ 4330 * require three upper case letters. */
4327 if (u > l && u > 2) 4331 if (u > l && u > 2)
4328 flags |= WF_ALLCAP; 4332 flags |= WF_ALLCAP;
4329 else if (first) 4333 else if (first)
4330 flags |= WF_ONECAP; 4334 flags |= WF_ONECAP;
4335
4336 if (u >= 2 && l >= 2) /* maCARONI maCAroni */
4337 flags |= WF_MIXCAP;
4331 } 4338 }
4332 return flags; 4339 return flags;
4333 } 4340 }
4334 4341
4335 # if defined(FEAT_MBYTE) || defined(EXITFREE) || defined(PROTO) 4342 # if defined(FEAT_MBYTE) || defined(EXITFREE) || defined(PROTO)
10893 preword + sp->ts_prewordlen, 10900 preword + sp->ts_prewordlen,
10894 sp->ts_prewordlen > 0); 10901 sp->ts_prewordlen > 0);
10895 10902
10896 /* Add the suggestion if the score isn't too bad. */ 10903 /* Add the suggestion if the score isn't too bad. */
10897 if (score <= su->su_maxscore) 10904 if (score <= su->su_maxscore)
10905 {
10898 add_suggestion(su, &su->su_ga, preword, 10906 add_suggestion(su, &su->su_ga, preword,
10899 sp->ts_fidx - repextra, 10907 sp->ts_fidx - repextra,
10900 score, 0, FALSE, lp->lp_sallang, FALSE); 10908 score, 0, FALSE, lp->lp_sallang, FALSE);
10909
10910 if (su->su_badflags & WF_MIXCAP)
10911 {
10912 /* We really don't know if the word should be
10913 * upper or lower case, add both. */
10914 c = captype(preword, NULL);
10915 if (c == 0 || c == WF_ALLCAP)
10916 {
10917 make_case_word(tword + sp->ts_splitoff,
10918 preword + sp->ts_prewordlen,
10919 c == 0 ? WF_ALLCAP : 0);
10920
10921 add_suggestion(su, &su->su_ga, preword,
10922 sp->ts_fidx - repextra,
10923 score + SCORE_ICASE, 0, FALSE,
10924 lp->lp_sallang, FALSE);
10925 }
10926 }
10927 }
10901 } 10928 }
10902 } 10929 }
10903 10930
10904 /* 10931 /*
10905 * Try word split and/or compounding. 10932 * Try word split and/or compounding.