.. _program_listing_file_src_command_marian_vocab.cpp: Program Listing for File marian_vocab.cpp ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``src/command/marian_vocab.cpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "marian.h" #include "common/cli_wrapper.h" #include "common/logging.h" #include "data/vocab.h" int main(int argc, char** argv) { using namespace marian; createLoggers(); Ptr options = New(); { YAML::Node config; // @TODO: get rid of YAML::Node here entirely to avoid the pattern. Currently not fixing as it requires more changes to the Options object. auto cli = New( config, "Create a vocabulary from text corpora given on STDIN", "Allowed options", "Examples:\n" " ./marian-vocab < text.src > vocab.yml\n" " cat text.src text.trg | ./marian-vocab > vocab.yml"); cli->add("--max-size,-m", "Generate only UINT most common vocabulary items", 0); cli->parse(argc, argv); options->merge(config); } LOG(info, "Creating vocabulary..."); auto vocab = New(options, 0); vocab->create("stdout", "stdin", options->get("max-size")); LOG(info, "Finished"); return 0; }