'Given a set of sentences, returns a vector of {1,0} values indicating ngram presence'

def _ngrams_in_sentence(self, example, ngrams):

    import numpy as np
    cleaned_sentence = self._remove_in_vocab_words_from_sentence(example)
    presence_vector = np.zeros(len(ngrams))
    idx_array = [idx for idx in range(len(ngrams)) if (ngrams[idx] in cleaned_sentence)]
    presence_vector[idx_array] = 1
    return presence_vector
