yumoxu / stocknet-code

Code for stock movement prediction from tweets and historical stock prices.
MIT License
204 stars 79 forks source link

what's the purpose of this function? #6

Open JJYsRepo opened 4 years ago

JJYsRepo commented 4 years ago

"""

def _get_unaligned_corpora(self, ss, main_target_date, vocab_id_dict):
    def get_ss_index(word_seq, ss):
        ss = ss.lower()
        ss_index = len(word_seq) - 1  # init
        if ss in word_seq:
            ss_index = word_seq.index(ss)
        else:
            if '$' in word_seq:
                dollar_index = word_seq.index('$')
                if dollar_index is not len(word_seq) - 1 and ss in word_seq[dollar_index + 1]:
                    ss_index = dollar_index + 1
                else:
                    for index in range(dollar_index + 1, len(word_seq)):
                        if ss in word_seq[index]:
                            ss_index = index
                            break
        return ss_index

""" This function is from def _get_unaligned_corpora in DataPipe.py file I am not sure what we are doing if stock symbol ss is not in the word_Seq?