MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SplitSentence

Function SplitSentence

tensorflow/lite/models/smartreply/predictor.cc:33–42  ·  view source on GitHub ↗

Split sentence into segments (using punctuation).

Source from the content-addressed store, hash-verified

31
32// Split sentence into segments (using punctuation).
33std::vector<std::string> SplitSentence(const std::string& input) {
34 string result(input);
35
36 RE2::GlobalReplace(&result, "([?.!,])+", " \\1");
37 RE2::GlobalReplace(&result, "([?.!,])+\\s+", "\\1\t");
38 RE2::GlobalReplace(&result, "[ ]+", " ");
39 RE2::GlobalReplace(&result, "\t+$", "");
40
41 return absl::StrSplit(result, '\t');
42}
43
44// Predict with TfLite model.
45void ExecuteTfLite(const std::string& sentence,

Callers 1

GetSegmentPredictionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected