MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / Add

Method Add

external/sentencepiece/src/trainer_interface.cc:135–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133 }
134
135 bool Add(const std::pair<std::string, int64_t> &sentence) {
136 if (spec_->input_sentence_size() == 0) {
137 sentences_->emplace_back(sentence);
138 } else {
139 if (spec_->shuffle_input_sentence()) {
140 sampler_->Add(sentence);
141 } else {
142 sentences_->emplace_back(sentence);
143 if (sentences_->size() >= spec_->input_sentence_size()) return false;
144 }
145 }
146
147 if (total_size() > 0 && total_size() % kTooBigSentencesSize == 0) {
148 LOG(INFO) << "Loaded " << total_size() << " lines";
149 }
150
151 return true;
152 }
153
154 size_t total_size() const {
155 return sampler_.get() ? sampler_->total_size() : sentences_->size();

Callers 1

LoadSentencesMethod · 0.45

Calls 3

input_sentence_sizeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected