Generate WordNetwork dict of Word() instance, and dump as a file if asked to.

    @Args:
    --
    df :        IDF value generated by find_tf_idf()
    tf_idf :    TF-IDF value generated by find_tf_idf()
    dump_path : file_path where to dump network entities, standart format is '.wrnt' (default=None)

    @returns:
    --
    word_net : list if Word() instances.(creating a network of words)

def generate_net(df,tf_idf,dump_path=None):
    '''Generate WordNetwork dict of Word() instance, and dump as a file if asked to.

    @Args:
    --
    df :        IDF value generated by find_tf_idf()
    tf_idf :    TF-IDF value generated by find_tf_idf()
    dump_path : file_path where to dump network entities, standart format is '.wrnt' (default=None)

    @returns:
    --
    word_net : list if Word() instances.(creating a network of words)
    '''
    # error handling
    if dump_path and dump_path[-4:] != __WRNT_FORMAT: raise Exception(__WRNG_FORMAT_MSG)

    start_t = datetime.now()
    print(TAG,'Network Genertion initiated..')
    word_net = {} # list of word entities.
    
    #registering all word instances in a dict of network
    for word in df.keys():
        word_net[word] = Word(word)
    print(TAG,'word-network instances created..',datetime.now()-start_t)
    start_t = datetime.now()

    #TODO: code for going through all the tf_idf elements and finding backward links and forward links of every word in word_net.
    for docs in tf_idf:
        for word in docs.keys():
            word_net[word].addtofrwrd_links(set(docs.keys()))
    print(TAG, 'word filled with their relative words(network generated)... ',datetime.now()-start_t)
    
    # Dump the generated lists if dump_path is given.
    if dump_path:
        start_t = datetime.now()
        __words = {}
        __network = []
        i=0
        # creating word dict for refrence in next stage.
        for word in word_net:
            __words[word] = i
            i+=1
        # creating final network list to be dumped. format=['word',1,2,3,4...(refrences from words dict)]
        for word in word_net:   
            __temp_list = [word]
            __temp_list.extend([__words[w] for w in word_net[word].frwrd_links])
            __network.append(__temp_list)
            del __temp_list
        print(TAG, 'created final relative-words list.. return ready.',datetime.now()-start_t)
        start_t = datetime.now()
        # Dumping data using pickle
        dump_file = open(dump_path,'wb')
        pickle.dump(__network,dump_file,protocol=pickle.HIGHEST_PROTOCOL)
        dump_file.close()
        print(TAG,'word network dumped @',dump_path,datetime.now()-start_t)
        #cleaning afterwards
        del __words
        del __network

    return word_net