diff options
author | Giulio Paci <giuliopaci@gmail.com> | 2013-05-29 04:39:16 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-29 10:47:09 +0100 |
commit | 6f083ae232014be43064b026f43af3040e6cca63 (patch) | |
tree | 829e9309031ac290c2ebf38b0a4765d0a65a4ae9 /src | |
parent | 18817a96822ad31f531b1f656a1ee350f00cd6b1 (diff) |
Enable changing mindocsize at runtime.
(cherry picked from commit 34e34485d1528dc4aa3ceb5c7c2111096ea3a6d0)
Diffstat (limited to 'src')
-rw-r--r-- | src/textcat.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/textcat.c b/src/textcat.c index 50d0e05..062f566 100644 --- a/src/textcat.c +++ b/src/textcat.c @@ -71,6 +71,7 @@ typedef struct unsigned char *fprint_disable; uint4 size; uint4 maxsize; + uint4 mindocsize; char output[MAXOUTPUTSIZE]; candidate_t *tmp_candidates; @@ -119,6 +120,14 @@ extern int textcat_SetProperty(void *handle, textcat_Property property, } return -2; break; + case TCPROP_MINIMUM_DOCUMENT_SIZE: + if (value > 0) + { + h->mindocsize = value; + return 0; + } + return -2; + break; default: break; } @@ -156,6 +165,7 @@ extern void *special_textcat_Init(const char *conffile, const char *prefix) h = (textcat_t *) malloc(sizeof(textcat_t)); h->size = 0; h->maxsize = 16; + h->mindocsize = MINDOCSIZE; h->fprint = (void **)malloc(sizeof(void *) * h->maxsize); h->fprint_disable = (unsigned char *)malloc(sizeof(unsigned char) * h->maxsize); @@ -310,7 +320,7 @@ extern int textcat_ClassifyFull(void *handle, const char *buffer, size_t size, unknown = fp_Init(NULL); fp_SetProperty(unknown, TCPROP_UTF8AWARE, h->utfaware); - fp_SetProperty(unknown, TCPROP_MINIMUM_DOCUMENT_SIZE, MINDOCSIZE); + fp_SetProperty(unknown, TCPROP_MINIMUM_DOCUMENT_SIZE, h->mindocsize); if (fp_Create(unknown, buffer, size, MAXNGRAMS) == 0) { /*** Too little information ***/ |