Esempio n. 1
0
        static void train(string[] args)
        {
            var a = new Args();

            a.ParseArgs(args);

            var fasttext       = new FastText();
            var outputFileName = a.output + ".bin";

            var ofs = new FileStream(outputFileName, FileMode.CreateNew, FileAccess.Write);

            if (!ofs.CanWrite)
            {
                throw new ArgumentException($"{outputFileName} cannot be opened for saving.");
            }
            ofs.Close();

            fasttext.Train(a);
            fasttext.SaveModel(outputFileName);
            fasttext.SaveVectors(a.output + ".vec");

            if (a.saveOutput)
            {
                fasttext.SaveOutput(a.output + ".output");
            }
        }