link-grammar-5.8.0/link-grammar/linkage/linkage.c
/* The character position is computed in a straightforward way, which may
 * not be efficient if more than one position is needed. If needed, it can
 * be changed to use caching of already-calculated positions. */
The character position is computed in a straightforward way, which may
not be efficient if more than one position is needed. If needed, it can
be changed to use caching of already-calculated positions.
The character position is computed in a straightforward way which may not be efficient if more than one position is needed . If needed it can be changed to use caching of already - calculated positions .
WordIdx linkage_get_word_char_start(const Linkage linkage, WordIdx w)
{
	if (linkage->num_words <= w) return (WordIdx)-1; 
	int pos = (int)(linkage->wg_path_display[w]->start - linkage->sent->orig_sentence);
	char *sentchunk = strndupa(linkage->sent->orig_sentence, pos);
	return utf8_strlen(sentchunk);
}
WordIdx linkage_get_word_char_start ( const Linkage linkage , WordIdx w ) { if ( linkage -> num_words <= w ) return ( WordIdx ) - 1 ; int pos = ( int ) ( linkage -> wg_path_display [ w ] -> start - linkage -> sent -> orig_sentence ) ; char * sentchunk = strndupa ( linkage -> sent -> orig_sentence , pos ) ; return utf8_strlen ( sentchunk ) ; }
The character position is computed in a straightforward way, which may
 not be efficient if more than one position is needed.
The character position is computed in a straightforward way which may not be efficient if more than one position is needed .
/* bounds-check */