Open Doragd opened 4 years ago
def populate_word_blacklist(word_index): blacklisted_words = set() blacklisted_words |= set(global_config.predefined_word_index.values()) if global_config.filter_sentiment_words: blacklisted_words |= lexicon_helper.get_sentiment_words() if global_config.filter_stopwords: blacklisted_words |= lexicon_helper.get_stopwords()
global_config.predefined_word_index.values()
global_config.predefined_word_index
word_index
{'<unk>': 0,'<sos>': 1,'<eos>': 2}
blacklisted_words
global_config.predefined_word_index.values()
are indices of some words, not words.global_config.predefined_word_index
is equal toword_index
, not only{'<unk>': 0,'<sos>': 1,'<eos>': 2}
.blacklisted_words
contains unnecessary words and does not match the meaning of the blacklist.