X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Ficu.h;h=973cc5d8adaa67d85bac9371704f2ee925003fb9;hp=7f396f2cf86cabcfef721c1671676c4b01f8e5f3;hb=ad88b93c8fbb00728acd0b49b4079167304ed58d;hpb=5242cb5a8634bfa38b9333ff7f903e718ac6e292 diff --git a/include/yaz/icu.h b/include/yaz/icu.h index 7f396f2..973cc5d 100644 --- a/include/yaz/icu.h +++ b/include/yaz/icu.h @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2012 Index Data. + * Copyright (C) 1995-2013 Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -55,7 +55,7 @@ YAZ_EXPORT void icu_chain_destroy(yaz_icu_chain_t chain); */ YAZ_EXPORT yaz_icu_chain_t icu_chain_xml_config(const xmlNode *xml_node, int sort, - UErrorCode * status); + UErrorCode *status); /** \brief pass string to ICU for parsing/tokenization/etc \param chain ICU chain to be used for parsing \param src8cstr input C string (null-terminated) @@ -64,7 +64,7 @@ YAZ_EXPORT yaz_icu_chain_t icu_chain_xml_config(const xmlNode *xml_node, \retval 1 success */ YAZ_EXPORT int icu_chain_assign_cstr(yaz_icu_chain_t chain, - const char * src8cstr, + const char *src8cstr, UErrorCode *status); /** \brief returns one token (if any) @@ -109,6 +109,14 @@ YAZ_EXPORT const char * icu_chain_token_norm(yaz_icu_chain_t chain); */ YAZ_EXPORT const char * icu_chain_token_sortkey(yaz_icu_chain_t chain); +/** \brief returns token as it relates to originl text + \param chain ICU chain + \param start offset in original text + \param size number of uchars in original text +*/ +YAZ_EXPORT void icu_chain_get_org_info(yaz_icu_chain_t chain, + size_t *start, size_t *len); + /** \brief ICU tokenizer iterator type (opaque) */ typedef struct icu_iter *yaz_icu_iter_t; @@ -170,6 +178,14 @@ const char *icu_iter_get_display(yaz_icu_iter_t iter); YAZ_EXPORT int icu_iter_get_token_number(yaz_icu_iter_t iter); +/** \brief returns ICU original token start (offset) and length + \param iter ICU tokenizer iterator + \param start offset of last token in original text + \param len length of last token in original text +*/ +YAZ_EXPORT +void icu_iter_get_org_info(yaz_icu_iter_t iter, size_t *start, size_t *len); + YAZ_END_CDECL #endif /* YAZ_ICU_H */