Example #1
0
        private double[] getTextAsVectorOfWords(Verse verse)
        {
            double[] vector = new double[inputLayerSize];

            // convert text to nGramStrategy
            ISet <String> uniqueValues = nGramStrategy.getNGram(verse.getText());

            // create vector
            //

            foreach (String word in uniqueValues)
            {
                VocabularyWord vw = findWordInVocabulary(word);

                if (vw != null)
                { // word found in vocabulary
                    vector[vw.getId() - 1] = 1;
                }
            }

            return(vector);
        }