示例#1
0
 def test_transform(self, documents):
     documents = [(tweet if is_ascii(tweet) else ' ') for tweet in
                  documents]
     documents = map(lambda x: processTweet(x), documents)
     documents = map(lambda x: str(x).translate(None, '"'),
                     documents)
     tweets_filtered = []
     for tweet in documents:
         if len(tweet) > 1:
             tweets_filtered.append(tweet)
     return tweets_filtered
示例#2
0
 def transform(self, documents, labels):
     documents = [(tweet if is_ascii(tweet) else ' ') for tweet in
                  documents]
     documents = map(lambda x: processTweet(x), documents)
     documents = map(lambda x: str(x).translate(None, '"'),
                     documents)
     (tweets_filtered, labels_filtered) = ([], [])
     for (tweet, label) in zip(documents, labels):
         if len(tweet) > 1:
             tweets_filtered.append(tweet)
             labels_filtered.append(label)
     return (tweets_filtered, labels_filtered)