+const char* yaz_stemmer_lookup_charenc(const char *charenc, const char *rule) {
+ return "UTF_8";
+}
+
+const char* yaz_stemmer_lookup_algorithm(const char *locale, const char *rule) {
+ return locale;
+}
+
+yaz_stemmer_p yaz_stemmer_snowball_create(const char *locale, const char *rule, UErrorCode *status) {
+ const char *charenc = yaz_stemmer_lookup_charenc(locale, rule);
+ const char *algorithm = yaz_stemmer_lookup_algorithm(locale,rule);
+ struct sb_stemmer *stemmer = sb_stemmer_new(algorithm, charenc);
+ yaz_stemmer_p yaz_stemmer;
+ if (stemmer == 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ yaz_log(YLOG_FATAL, "yaz_stemmer: Failed to create snowball stemmer from locale %srule %s. Showball: charenc %s algorithm %s ",
+ locale, rule, charenc, algorithm);
+ return 0;
+ }
+ yaz_log(YLOG_DEBUG, "created snowball stemmer: algorithm %s charenc %s ", algorithm, charenc);
+ yaz_stemmer = xmalloc(sizeof(*yaz_stemmer));
+ yaz_stemmer->implementation = yaz_snowball;
+
+ yaz_stemmer->locale = xstrdup(locale);
+ yaz_stemmer->rule = xstrdup(rule);
+ yaz_stemmer->sb_stemmer = stemmer;
+ yaz_log(YLOG_DEBUG, "created snowball stemmer: algorithm %s charenc %s ", algorithm, charenc);
+ return yaz_stemmer;
+}
+