Пример #1
0
        /// <summary>
        /// Creates and returns vector db from the input letters located in the input folder
        /// </summary>
        /// <param name="printLetters">if true , prints each letter to the console</param>
        /// <returns>the vector db</returns>
        public static List<InputDataStructure> CreateVectorsDb(bool printLetters = false)
        {
            Console.WriteLine("Creating vector db from the letters in the input folder : " + LettersDirectoryPath);

            // get all the letters from the input directory
            string[] fileEntries = Directory.GetFiles(Path.GetFullPath(LettersDirectoryPath), FileTypes);

            // initialize the vectors db
            var allData = new List<InputDataStructure>();

            // for each letter, create it's represntation vector
            foreach (var fileEntry in fileEntries)
            {
                // create new heb letter input from the file
                var letter = new HebLetterInputDataStructure(fileEntry);

                // add it to the input list
                allData.Add(letter);

                // print the current letter to the console
                if (printLetters) Console.WriteLine(letter);
            }

            // return the vector db
            return allData;
        }
 public override InputDataStructure GetCopy()
 {
     var copy = new HebLetterInputDataStructure(DataVector.Length, TargetVector.Length);
     Array.Copy(DataVector, copy.DataVector, DataVector.Length);
     Array.Copy(TargetVector, copy.TargetVector, TargetVector.Length);
     return copy;
 }