Skip to content

Avoid repeatedly calling into char_indices to build ngrams - #457

Open
adamreichold wants to merge 2 commits into
pemistahl:mainfrom
adamreichold:repeated-char-indices
Open

Avoid repeatedly calling into char_indices to build ngrams#457
adamreichold wants to merge 2 commits into
pemistahl:mainfrom
adamreichold:repeated-char-indices

Conversation

@adamreichold

Copy link
Copy Markdown
Contributor

This adds a single allocation of an appropriately sized deque shared between all words of a text to avoid repeatedly restarting the UTF-8 decoding of the words. Instead a single pass using char_indices suffices by keeping the last n indices as upcoming offsets in the deque.

This adds a single allocation of an appropriately sized deque shared between all
words of a text to avoid repeatedly restarting the UTF-8 decoding of the words.
Instead a single pass using char_indices suffices by keeping the last n indices
as upcoming offsets in the deque.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants