Added example on load model from std::istream

This commit is contained in:
resec 2017-07-20 10:50:38 +08:00 коммит произвёл GitHub
Родитель bd5f5ba690
Коммит fe95e7c092
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -2,13 +2,16 @@
## Load SentencePiece model
To start working with the SentencePiece model, you will want to include the `sentencepiece_processor.h` header file.
Then instantiate sentencepiece::SentencePieceProcessor class and calls `Load`or `LoadOrDie` method to load the model file.
Then instantiate sentencepiece::SentencePieceProcessor class and calls `Load`or `LoadOrDie` method to load the model with file path or std::istream.
```
#include <sentencepiece_processor.h>
sentencepiece::SentencePieceProcessor processor;
processor.LoadOrDie("//path/to/model.model");
// Or load from std::istream of anything
// std::ifstream in("//path/to/model.model");
// processor.LoadOrDie(in);
```
## Tokenize text (preprocessing)