Skip to content

Modernize ReadNGramList in SFst shrink with absl::StrSplit. - #47

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara/979146682
Open

Modernize ReadNGramList in SFst shrink with absl::StrSplit.#47
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara/979146682

Conversation

@copybara-service

Copy link
Copy Markdown

Modernize ReadNGramList in SFst shrink with absl::StrSplit.

  • Eliminates per-line std::stringstream buffer allocation in sfst::ReadNGramList by tokenizing lines with absl::StrSplit and absl::string_view.
  • Uses zero-copy string view lookup in fst::SymbolTable::Find and moves parsed n-gram vectors into the destination set.
  • Adds null pointer safety check for destination ngram_list.

* Eliminates per-line `std::stringstream` buffer allocation in `sfst::ReadNGramList` by tokenizing lines with `absl::StrSplit` and `absl::string_view`.
* Uses zero-copy string view lookup in `fst::SymbolTable::Find` and moves parsed n-gram vectors into the destination set.
* Adds null pointer safety check for destination ngram_list.

PiperOrigin-RevId: 979146682
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant