Sha256: d1271ef17ad0a29018e2baf30d1952f9fad18d1439a330e68ae31fce6c25b2ae

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

/* 
 * example of Snowball dictionary
 * http://snowball.tartarus.org/ 
 * Teodor Sigaev <teodor@sigaev.ru>
 */
#include <stdlib.h>
#include <string.h>

#include "postgres.h"

#include "dict.h"
#include "common.h"
#include "snowball/header.h"
#include "subinclude.h"

typedef struct {
	struct SN_env *z;
	StopList	stoplist;
	int	(*stem)(struct SN_env * z);
} DictSnowball;


PG_FUNCTION_INFO_V1(dinit_german);
Datum dinit_german(PG_FUNCTION_ARGS);

Datum 
dinit_german(PG_FUNCTION_ARGS) {
	DictSnowball	*d = (DictSnowball*)malloc( sizeof(DictSnowball) );

	if ( !d )
		ereport(ERROR,
				(errcode(ERRCODE_OUT_OF_MEMORY),
				 errmsg("out of memory")));
	memset(d,0,sizeof(DictSnowball));
	d->stoplist.wordop=lowerstr;
		
	if ( !PG_ARGISNULL(0) && PG_GETARG_POINTER(0)!=NULL ) {
		text       *in = PG_GETARG_TEXT_P(0);
		readstoplist(in, &(d->stoplist));
		sortstoplist(&(d->stoplist));
		PG_FREE_IF_COPY(in, 0);
	}

	d->z = german_create_env();
	if (!d->z) {
		freestoplist(&(d->stoplist));
		ereport(ERROR,
				(errcode(ERRCODE_OUT_OF_MEMORY),
				 errmsg("out of memory")));
	}
	d->stem=german_stem;

	PG_RETURN_POINTER(d);
}


Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
oddb.org-1.0.2 ext/fulltext/redist/dict_german/dict_snowball.c
oddb.org-1.0.1 ext/fulltext/redist/dict_german/dict_snowball.c
de.oddb-2.0.1 data/fulltext/redist/dict_german/dict_snowball.c
ramaze.ch.oddb.org-1.0.0 data/fulltext/redist/dict_german/dict_snowball.c
de.oddb-2.0.0 data/fulltext/redist/dict_german/dict_snowball.c
oddb.org-1.0.0 ext/fulltext/redist/dict_german/dict_snowball.c