From: Adam Dickmeiss Date: Tue, 31 Mar 2015 12:58:29 +0000 (+0200) Subject: yaz-icu option -o writes original string as well X-Git-Tag: v5.11.0~1 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=a30e26753188529e2c8c896e9780e34d196d16d8;hp=35c32d033bf5d7201cb72a68d88e118e1851dc40 yaz-icu option -o writes original string as well This changes the output and so test results must be updated. yaz-icu now uses new facilities of YAZ-836. --- diff --git a/test/test_icu.0.output b/test/test_icu.0.output index ba0c37c..c34bcb1 100644 --- a/test/test_icu.0.output +++ b/test/test_icu.0.output @@ -1,7 +1,7 @@ -1 1 'børn' 'Børn' 0+5 -2 2 'le' 'Le' 0+3 -3 2 'carré' 'Carré' 3+6 -4 3 'le' 'Le' 0+3 -5 3 'carre' 'Carre' 3+5 -6 4 'le' 'Le' 0+3 -7 4 'carré' 'Carré' 3+7 +1 1 'børn' 'Børn' 0+5 *Børn* +2 2 'le' 'Le' 0+3 *Le *Carré +3 2 'carré' 'Carré' 3+6 Le *Carré* +4 3 'le' 'Le' 0+3 *Le *Carre +5 3 'carre' 'Carre' 3+5 Le *Carre* +6 4 'le' 'Le' 0+3 *Le *Carré +7 4 'carré' 'Carré' 3+7 Le *Carré* diff --git a/test/test_icu.1.output b/test/test_icu.1.output index ba8e613..8a0b32c 100644 --- a/test/test_icu.1.output +++ b/test/test_icu.1.output @@ -1,7 +1,7 @@ -1 1 'børn' 'Børn' 0+5 -2 2 'le' 'Le' 0+3 -3 2 'carre' 'Carre' 3+6 -4 3 'le' 'Le' 0+3 -5 3 'carre' 'Carre' 3+5 -6 4 'le' 'Le' 0+3 -7 4 'carre' 'Carre' 3+7 +1 1 'børn' 'Børn' 0+5 *Børn* +2 2 'le' 'Le' 0+3 *Le *Carré +3 2 'carre' 'Carre' 3+6 Le *Carré* +4 3 'le' 'Le' 0+3 *Le *Carre +5 3 'carre' 'Carre' 3+5 Le *Carre* +6 4 'le' 'Le' 0+3 *Le *Carré +7 4 'carre' 'Carre' 3+7 Le *Carré* diff --git a/test/test_icu.2.output b/test/test_icu.2.output index d8bf7c6..fdff316 100644 --- a/test/test_icu.2.output +++ b/test/test_icu.2.output @@ -1,4 +1,6 @@ 1 1 '‘a' -' '' 0+4 +' '' 0+4 *`a' +* 2 2 '“a'' -' '' 0+6 +' '' 0+6 *``a'' +* diff --git a/test/test_icu.3.output b/test/test_icu.3.output index 3fe68cc..b85056b 100644 --- a/test/test_icu.3.output +++ b/test/test_icu.3.output @@ -1,4 +1,4 @@ -1 1 'men' '' 0+4 -2 1 'run' '' 4+7 -3 2 'he' '' 0+3 -4 2 'run' '' 3+5 +1 1 'men' '' 0+4 *men *running +2 1 'run' '' 4+7 men *running* +3 2 'he' '' 0+3 *he *runs +4 2 'run' '' 3+5 he *runs * diff --git a/test/test_icu.4.output b/test/test_icu.4.output index 5bbdaed..01dd145 100644 --- a/test/test_icu.4.output +++ b/test/test_icu.4.output @@ -1 +1 @@ -1 1 'Andersen, H.C' '' 0+15 +1 1 'Andersen, H.C' '' 0+15 *Andersen, H.C.,* diff --git a/util/yaz-icu.c b/util/yaz-icu.c index 1386a16..ac7806a 100644 --- a/util/yaz-icu.c +++ b/util/yaz-icu.c @@ -479,9 +479,11 @@ static void process_text_file(struct config_t *p_config) else { size_t start, len; + const char *org_string = 0; const char *sortkey = icu_chain_token_sortkey(p_config->chain); - icu_chain_get_org_info(p_config->chain, &start, &len); + icu_chain_get_org_info2(p_config->chain, &start, &len, + &org_string); wrbuf_rewind(sw); wrbuf_puts_escaped(sw, sortkey); token_count++; @@ -525,6 +527,12 @@ static void process_text_file(struct config_t *p_config) { fprintf(p_config->outfile, " %ld+%ld", (long) start, (long) len); + fputc(' ', p_config->outfile); + fwrite(org_string, 1, start, p_config->outfile); + fputc('*', p_config->outfile); + fwrite(org_string + start, 1, len, p_config->outfile); + fputc('*', p_config->outfile); + fputs(org_string + start + len, p_config->outfile); } fprintf(p_config->outfile, "\n"); }