示例#1
0
 /**
  * Returns a sentence comprised of only existent words in the original sentence sent.
  *
  * @param sent sentence
  * @return sentence without nonsense words
  */
 public String getFoundWords(String sent) {
   String foundUniq = "";
   String[] splitSent = sent.split(" ");
   for (int i = 0; i < splitSent.length; i++) // For each word
   {
     double[] wordVector = allWordsVec.getVectorOfWord(splitSent[i]);
     if (wordVector[0] != -100) {
       foundUniq += splitSent[i] + " ";
     }
   }
   return foundUniq;
 }
示例#2
0
 /**
  * Finds the word vectors for all words in a sentence.
  *
  * @param sent sentence
  * @return Word vectors for sentence
  */
 public List<double[]> CreateWordVector(String sent) {
   List<double[]> wordVecs = new ArrayList<double[]>();
   String[] splitSent = sent.split(" ");
   for (int i = 0; i < splitSent.length; i++) // For each word
   {
     double[] wordVector = allWordsVec.getVectorOfWord(splitSent[i]);
     if (wordVector[0] != -100) {
       wordVecs.add(wordVector);
     }
   }
   return wordVecs;
 }