Header And Logo

PostgreSQL
| The world's most advanced open source database.

stem_UTF_8_norwegian.c

Go to the documentation of this file.
00001 
00002 /* This file was generated automatically by the Snowball to ANSI C compiler */
00003 
00004 #include "header.h"
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009 extern int norwegian_UTF_8_stem(struct SN_env * z);
00010 #ifdef __cplusplus
00011 }
00012 #endif
00013 static int r_other_suffix(struct SN_env * z);
00014 static int r_consonant_pair(struct SN_env * z);
00015 static int r_main_suffix(struct SN_env * z);
00016 static int r_mark_regions(struct SN_env * z);
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 
00022 extern struct SN_env * norwegian_UTF_8_create_env(void);
00023 extern void norwegian_UTF_8_close_env(struct SN_env * z);
00024 
00025 
00026 #ifdef __cplusplus
00027 }
00028 #endif
00029 static const symbol s_0_0[1] = { 'a' };
00030 static const symbol s_0_1[1] = { 'e' };
00031 static const symbol s_0_2[3] = { 'e', 'd', 'e' };
00032 static const symbol s_0_3[4] = { 'a', 'n', 'd', 'e' };
00033 static const symbol s_0_4[4] = { 'e', 'n', 'd', 'e' };
00034 static const symbol s_0_5[3] = { 'a', 'n', 'e' };
00035 static const symbol s_0_6[3] = { 'e', 'n', 'e' };
00036 static const symbol s_0_7[6] = { 'h', 'e', 't', 'e', 'n', 'e' };
00037 static const symbol s_0_8[4] = { 'e', 'r', 't', 'e' };
00038 static const symbol s_0_9[2] = { 'e', 'n' };
00039 static const symbol s_0_10[5] = { 'h', 'e', 't', 'e', 'n' };
00040 static const symbol s_0_11[2] = { 'a', 'r' };
00041 static const symbol s_0_12[2] = { 'e', 'r' };
00042 static const symbol s_0_13[5] = { 'h', 'e', 't', 'e', 'r' };
00043 static const symbol s_0_14[1] = { 's' };
00044 static const symbol s_0_15[2] = { 'a', 's' };
00045 static const symbol s_0_16[2] = { 'e', 's' };
00046 static const symbol s_0_17[4] = { 'e', 'd', 'e', 's' };
00047 static const symbol s_0_18[5] = { 'e', 'n', 'd', 'e', 's' };
00048 static const symbol s_0_19[4] = { 'e', 'n', 'e', 's' };
00049 static const symbol s_0_20[7] = { 'h', 'e', 't', 'e', 'n', 'e', 's' };
00050 static const symbol s_0_21[3] = { 'e', 'n', 's' };
00051 static const symbol s_0_22[6] = { 'h', 'e', 't', 'e', 'n', 's' };
00052 static const symbol s_0_23[3] = { 'e', 'r', 's' };
00053 static const symbol s_0_24[3] = { 'e', 't', 's' };
00054 static const symbol s_0_25[2] = { 'e', 't' };
00055 static const symbol s_0_26[3] = { 'h', 'e', 't' };
00056 static const symbol s_0_27[3] = { 'e', 'r', 't' };
00057 static const symbol s_0_28[3] = { 'a', 's', 't' };
00058 
00059 static const struct among a_0[29] =
00060 {
00061 /*  0 */ { 1, s_0_0, -1, 1, 0},
00062 /*  1 */ { 1, s_0_1, -1, 1, 0},
00063 /*  2 */ { 3, s_0_2, 1, 1, 0},
00064 /*  3 */ { 4, s_0_3, 1, 1, 0},
00065 /*  4 */ { 4, s_0_4, 1, 1, 0},
00066 /*  5 */ { 3, s_0_5, 1, 1, 0},
00067 /*  6 */ { 3, s_0_6, 1, 1, 0},
00068 /*  7 */ { 6, s_0_7, 6, 1, 0},
00069 /*  8 */ { 4, s_0_8, 1, 3, 0},
00070 /*  9 */ { 2, s_0_9, -1, 1, 0},
00071 /* 10 */ { 5, s_0_10, 9, 1, 0},
00072 /* 11 */ { 2, s_0_11, -1, 1, 0},
00073 /* 12 */ { 2, s_0_12, -1, 1, 0},
00074 /* 13 */ { 5, s_0_13, 12, 1, 0},
00075 /* 14 */ { 1, s_0_14, -1, 2, 0},
00076 /* 15 */ { 2, s_0_15, 14, 1, 0},
00077 /* 16 */ { 2, s_0_16, 14, 1, 0},
00078 /* 17 */ { 4, s_0_17, 16, 1, 0},
00079 /* 18 */ { 5, s_0_18, 16, 1, 0},
00080 /* 19 */ { 4, s_0_19, 16, 1, 0},
00081 /* 20 */ { 7, s_0_20, 19, 1, 0},
00082 /* 21 */ { 3, s_0_21, 14, 1, 0},
00083 /* 22 */ { 6, s_0_22, 21, 1, 0},
00084 /* 23 */ { 3, s_0_23, 14, 1, 0},
00085 /* 24 */ { 3, s_0_24, 14, 1, 0},
00086 /* 25 */ { 2, s_0_25, -1, 1, 0},
00087 /* 26 */ { 3, s_0_26, 25, 1, 0},
00088 /* 27 */ { 3, s_0_27, -1, 3, 0},
00089 /* 28 */ { 3, s_0_28, -1, 1, 0}
00090 };
00091 
00092 static const symbol s_1_0[2] = { 'd', 't' };
00093 static const symbol s_1_1[2] = { 'v', 't' };
00094 
00095 static const struct among a_1[2] =
00096 {
00097 /*  0 */ { 2, s_1_0, -1, -1, 0},
00098 /*  1 */ { 2, s_1_1, -1, -1, 0}
00099 };
00100 
00101 static const symbol s_2_0[3] = { 'l', 'e', 'g' };
00102 static const symbol s_2_1[4] = { 'e', 'l', 'e', 'g' };
00103 static const symbol s_2_2[2] = { 'i', 'g' };
00104 static const symbol s_2_3[3] = { 'e', 'i', 'g' };
00105 static const symbol s_2_4[3] = { 'l', 'i', 'g' };
00106 static const symbol s_2_5[4] = { 'e', 'l', 'i', 'g' };
00107 static const symbol s_2_6[3] = { 'e', 'l', 's' };
00108 static const symbol s_2_7[3] = { 'l', 'o', 'v' };
00109 static const symbol s_2_8[4] = { 'e', 'l', 'o', 'v' };
00110 static const symbol s_2_9[4] = { 's', 'l', 'o', 'v' };
00111 static const symbol s_2_10[7] = { 'h', 'e', 't', 's', 'l', 'o', 'v' };
00112 
00113 static const struct among a_2[11] =
00114 {
00115 /*  0 */ { 3, s_2_0, -1, 1, 0},
00116 /*  1 */ { 4, s_2_1, 0, 1, 0},
00117 /*  2 */ { 2, s_2_2, -1, 1, 0},
00118 /*  3 */ { 3, s_2_3, 2, 1, 0},
00119 /*  4 */ { 3, s_2_4, 2, 1, 0},
00120 /*  5 */ { 4, s_2_5, 4, 1, 0},
00121 /*  6 */ { 3, s_2_6, -1, 1, 0},
00122 /*  7 */ { 3, s_2_7, -1, 1, 0},
00123 /*  8 */ { 4, s_2_8, 7, 1, 0},
00124 /*  9 */ { 4, s_2_9, 7, 1, 0},
00125 /* 10 */ { 7, s_2_10, 9, 1, 0}
00126 };
00127 
00128 static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
00129 
00130 static const unsigned char g_s_ending[] = { 119, 125, 149, 1 };
00131 
00132 static const symbol s_0[] = { 'k' };
00133 static const symbol s_1[] = { 'e', 'r' };
00134 
00135 static int r_mark_regions(struct SN_env * z) {
00136     z->I[0] = z->l;
00137     {   int c_test = z->c; /* test, line 30 */
00138         {   int ret = skip_utf8(z->p, z->c, 0, z->l, + 3);
00139             if (ret < 0) return 0;
00140             z->c = ret; /* hop, line 30 */
00141         }
00142         z->I[1] = z->c; /* setmark x, line 30 */
00143         z->c = c_test;
00144     }
00145     if (out_grouping_U(z, g_v, 97, 248, 1) < 0) return 0; /* goto */ /* grouping v, line 31 */
00146     {    /* gopast */ /* non v, line 31 */
00147         int ret = in_grouping_U(z, g_v, 97, 248, 1);
00148         if (ret < 0) return 0;
00149         z->c += ret;
00150     }
00151     z->I[0] = z->c; /* setmark p1, line 31 */
00152      /* try, line 32 */
00153     if (!(z->I[0] < z->I[1])) goto lab0;
00154     z->I[0] = z->I[1];
00155 lab0:
00156     return 1;
00157 }
00158 
00159 static int r_main_suffix(struct SN_env * z) {
00160     int among_var;
00161     {   int mlimit; /* setlimit, line 38 */
00162         int m1 = z->l - z->c; (void)m1;
00163         if (z->c < z->I[0]) return 0;
00164         z->c = z->I[0]; /* tomark, line 38 */
00165         mlimit = z->lb; z->lb = z->c;
00166         z->c = z->l - m1;
00167         z->ket = z->c; /* [, line 38 */
00168         if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851426 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; }
00169         among_var = find_among_b(z, a_0, 29); /* substring, line 38 */
00170         if (!(among_var)) { z->lb = mlimit; return 0; }
00171         z->bra = z->c; /* ], line 38 */
00172         z->lb = mlimit;
00173     }
00174     switch(among_var) {
00175         case 0: return 0;
00176         case 1:
00177             {   int ret = slice_del(z); /* delete, line 44 */
00178                 if (ret < 0) return ret;
00179             }
00180             break;
00181         case 2:
00182             {   int m2 = z->l - z->c; (void)m2; /* or, line 46 */
00183                 if (in_grouping_b_U(z, g_s_ending, 98, 122, 0)) goto lab1;
00184                 goto lab0;
00185             lab1:
00186                 z->c = z->l - m2;
00187                 if (!(eq_s_b(z, 1, s_0))) return 0;
00188                 if (out_grouping_b_U(z, g_v, 97, 248, 0)) return 0;
00189             }
00190         lab0:
00191             {   int ret = slice_del(z); /* delete, line 46 */
00192                 if (ret < 0) return ret;
00193             }
00194             break;
00195         case 3:
00196             {   int ret = slice_from_s(z, 2, s_1); /* <-, line 48 */
00197                 if (ret < 0) return ret;
00198             }
00199             break;
00200     }
00201     return 1;
00202 }
00203 
00204 static int r_consonant_pair(struct SN_env * z) {
00205     {   int m_test = z->l - z->c; /* test, line 53 */
00206         {   int mlimit; /* setlimit, line 54 */
00207             int m1 = z->l - z->c; (void)m1;
00208             if (z->c < z->I[0]) return 0;
00209             z->c = z->I[0]; /* tomark, line 54 */
00210             mlimit = z->lb; z->lb = z->c;
00211             z->c = z->l - m1;
00212             z->ket = z->c; /* [, line 54 */
00213             if (z->c - 1 <= z->lb || z->p[z->c - 1] != 116) { z->lb = mlimit; return 0; }
00214             if (!(find_among_b(z, a_1, 2))) { z->lb = mlimit; return 0; } /* substring, line 54 */
00215             z->bra = z->c; /* ], line 54 */
00216             z->lb = mlimit;
00217         }
00218         z->c = z->l - m_test;
00219     }
00220     {   int ret = skip_utf8(z->p, z->c, z->lb, 0, -1);
00221         if (ret < 0) return 0;
00222         z->c = ret; /* next, line 59 */
00223     }
00224     z->bra = z->c; /* ], line 59 */
00225     {   int ret = slice_del(z); /* delete, line 59 */
00226         if (ret < 0) return ret;
00227     }
00228     return 1;
00229 }
00230 
00231 static int r_other_suffix(struct SN_env * z) {
00232     int among_var;
00233     {   int mlimit; /* setlimit, line 63 */
00234         int m1 = z->l - z->c; (void)m1;
00235         if (z->c < z->I[0]) return 0;
00236         z->c = z->I[0]; /* tomark, line 63 */
00237         mlimit = z->lb; z->lb = z->c;
00238         z->c = z->l - m1;
00239         z->ket = z->c; /* [, line 63 */
00240         if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4718720 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; }
00241         among_var = find_among_b(z, a_2, 11); /* substring, line 63 */
00242         if (!(among_var)) { z->lb = mlimit; return 0; }
00243         z->bra = z->c; /* ], line 63 */
00244         z->lb = mlimit;
00245     }
00246     switch(among_var) {
00247         case 0: return 0;
00248         case 1:
00249             {   int ret = slice_del(z); /* delete, line 67 */
00250                 if (ret < 0) return ret;
00251             }
00252             break;
00253     }
00254     return 1;
00255 }
00256 
00257 extern int norwegian_UTF_8_stem(struct SN_env * z) {
00258     {   int c1 = z->c; /* do, line 74 */
00259         {   int ret = r_mark_regions(z);
00260             if (ret == 0) goto lab0; /* call mark_regions, line 74 */
00261             if (ret < 0) return ret;
00262         }
00263     lab0:
00264         z->c = c1;
00265     }
00266     z->lb = z->c; z->c = z->l; /* backwards, line 75 */
00267 
00268     {   int m2 = z->l - z->c; (void)m2; /* do, line 76 */
00269         {   int ret = r_main_suffix(z);
00270             if (ret == 0) goto lab1; /* call main_suffix, line 76 */
00271             if (ret < 0) return ret;
00272         }
00273     lab1:
00274         z->c = z->l - m2;
00275     }
00276     {   int m3 = z->l - z->c; (void)m3; /* do, line 77 */
00277         {   int ret = r_consonant_pair(z);
00278             if (ret == 0) goto lab2; /* call consonant_pair, line 77 */
00279             if (ret < 0) return ret;
00280         }
00281     lab2:
00282         z->c = z->l - m3;
00283     }
00284     {   int m4 = z->l - z->c; (void)m4; /* do, line 78 */
00285         {   int ret = r_other_suffix(z);
00286             if (ret == 0) goto lab3; /* call other_suffix, line 78 */
00287             if (ret < 0) return ret;
00288         }
00289     lab3:
00290         z->c = z->l - m4;
00291     }
00292     z->c = z->lb;
00293     return 1;
00294 }
00295 
00296 extern struct SN_env * norwegian_UTF_8_create_env(void) { return SN_create_env(0, 2, 0); }
00297 
00298 extern void norwegian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); }
00299