// See the License for the specific language governing permissions and
// limitations under the License.!
+#include "trainer_interface.h"
+
#include <algorithm>
#include <cstdlib>
#include <memory>
#include "third_party/absl/strings/str_format.h"
#include "third_party/absl/strings/str_join.h"
#include "third_party/absl/strings/str_split.h"
-#include "trainer_interface.h"
#include "unicode_script.h"
#include "util.h"
auto output = filesystem::NewWritableFile(filename);
RETURN_IF_ERROR(output->status());
+ for (const auto &piece : model_proto.pieces()) {
+ if (piece.piece().find_first_of(" \t\r\n") != std::string::npos) {
+ LOG(WARNING) << "The piece [" << piece.piece()
+ << "] contains escaped characters that break the format of "
+ << filename;
+ }
+ }
+
if (trainer_spec_.vocabulary_output_piece_score()) {
for (const auto &piece : model_proto.pieces()) {
std::ostringstream os;
// See the License for the specific language governing permissions and
// limitations under the License.!
-#include <iostream>
-
#include "util.h"
+#include <iostream>
+
namespace sentencepiece {
namespace {
std::vector<std::string> result;
for (; str < eos; ++str) {
- while (*str == ' ' || *str == '\t') ++str;
if (*str == '"') {
start = ++str;
end = start;