コード例 #1
0
    def __init__(self,
                 vector_cache=True,
                 rerank_model: PathLike = None,
                 emb_model_path: PathLike = None):
        # model and training params
        self.embeddings_len = 300
        self.activation_1 = 'relu'
        self.activation_2 = 'relu'
        self.activation_3 = 'sigmoid'
        self.loss = 'binary_crossentropy'
        self.optimizer = 'rmsprop'

        self.epochs_and_batch_size = [(10, 2)]
        self.seeds = [3]
        self.threshold = 0.5

        self.sim_lexicon = TRAIN_LEXICONS / 'RerankSentSimLex.csv'
        self.generic_lexicon = GENERIC_OP_LEX

        self.vector_cache = vector_cache
        self.word_vectors_dict = {}
        self.vectors_sim_dict = {}

        self.rerank_model_path = rerank_model
        self.emb_model_path = emb_model_path

        LEXICONS_OUT.mkdir(parents=True, exist_ok=True)

        tensorflow.logging.set_verbosity(tensorflow.logging.ERROR)
コード例 #2
0
    def _write_candidate_opinion_lex(self):
        """
        write generated lexicons to csv files
        """
        LEXICONS_OUT.mkdir(parents=True, exist_ok=True)

        _write_final_opinion_lex(self.opinion_candidates_list_final,
                                 self.acquired_opinion_terms_path)