def execute_parallel_baseline_1_max_tree(language,
                                             train_models=False,
                                             is_train_dev_together=True):
        if (train_models):
            logging.info('-' * 50)
            logging.info('Training process started')
            tp.train_parser_all_lng(language, is_train_dev_together)
            logging.info('Training process ended')

        logging.info('-' * 50)
        logging.info('Noised dependency trees creation started')
        noise_maker.create_noised_dps_over_all_languages(
            language, is_train_dev_together)
        logging.info('Noised dependency trees creation ended')

        logging.info('-' * 50)
        logging.info('mst wrapper started')
        mst_wrapper.mst_wrapper_for_all_languages(
            language,
            final_file_name='final_liang_1_best_after_predicted_pos',
            is_train_dev_together=is_train_dev_together,
            is_mst=False,
            given_one_file_repeated_sentnces=False)
        logging.info('mst wrapper ended')

        return language + " is ready"
    def execute_parallel_baseline_k_best_trees(language,train_models = False,is_train_dev_together=True):
        if (train_models):
            logging.info('-'*50)
            logging.info('Training process started')
            tp.train_parser_all_lng(language,is_train_dev_together)
            logging.info('Training process ended')


        logging.info('-' * 50)
        logging.info('K-best (liang) dependency trees creation started')
        noise_maker.create_noised_dps_over_all_languages(specific_languages = language,
                                                         is_train_dev_together=True,
                                                         k_best_baseline = 100)
        logging.info('K-best (liang) dependency trees creation ended')


        logging.info('-' * 50)
        logging.info('mst wrapper started')
        mst_wrapper.mst_wrapper_for_all_languages(language,
                                                  final_file_name='UAS_liang_Kbest_baseline_k_100_after_predicted_pos',
                                                  is_train_dev_together = is_train_dev_together,
                                                  is_mst=True,
                                                  given_one_file_repeated_sentnces=True)
        logging.info('mst wrapper ended')

        logging.info('-' * 50)
        logging.info('Oracle wrapper started')
        oracle_wrapper.oracle_wrapper_for_all_languages(language,final_file_name = 'UAS_liang_Kbest_baseline_k_100_after_predicted_pos' ,is_train_dev_together=True)
        logging.info('Oracle wrapper ended')
        return language+" is ready"
    def execute_parallel(language,eval_method='oracle',train_models = True,find_noise = True,is_oracle_inference_results=True,fixed_noise=False,noise_method='m'):
        if (train_models):
            logging.info('-'*50)
            logging.info('Training process started')
            tp.train_parser_all_lng(language)
            logging.info('Training process ended')

        if (find_noise):
            logging.info('-' * 50)
            logging.info('Optimal noise learning started')
            optimal_n.find_optimal_noise_per_language(eval_method=eval_method,specific_languages=language,noise_method=noise_method)
            logging.info('Optimal noise learning ended')

        logging.info('-' * 50)
        logging.info('Noised dependency trees creation started')
        noise_maker.create_noised_dps_over_all_languages(language,is_train_dev_together= False,k_best_baseline=False,fixed_noise=fixed_noise,noise_method=noise_method)
        logging.info('Noised dependency trees creation ended')


        logging.info('-' * 50)
        logging.info('mst wrapper started')
        mst_wrapper.mst_wrapper_for_all_languages(language,
                                                  final_file_name='UAS_perturbated_MLN_perturbated_after_predicted_pos',
                                                  is_train_dev_together=False,
                                                  is_mst=True,
                                                  given_one_file_repeated_sentnces=False,
                                                  remove_less_than_k_duplication=False)
        logging.info('mst wrapper ended')

        if (is_oracle_inference_results):
            logging.info('Oracle wrapper started')
            oracle_wrapper.oracle_wrapper_for_all_languages(language,final_file_name = 'UAS_perturbated_MLN_perturbated_after_predicted_pos' ,is_train_dev_together=False)
            logging.info('Oracle wrapper ended')

        return language+" is ready"
示例#4
0
    def execute(self):
        logging.info('Execution started')
        if (self.create_files):
            logging.info('Strat creating per language files')
            tp.create_files_per_language()
            logging.info('Finish creating per language files')

        if (self.train_models):
            logging.info('-'*50)
            logging.info('Training process started')
            tp.train_parser_all_lng()
            logging.info('Training process ended')


        logging.info('-' * 50)
        logging.info('Optimal noise learning started')
        optimal_n.find_optimal_noise_per_language()
        logging.info('Optimal noise learning ended')

        logging.info('-' * 50)
        logging.info('Noised dependency trees creation started')
        noise_maker.create_noised_dps_over_all_languages()
        logging.info('Noised dependency trees creation ended')

        logging.info('-' * 50)
        logging.info('mst wrapper started')
        mst_wrapper.mst_wrapper_for_all_languages()
        logging.info('Nmst wrapper ended')
    def execute_parallel(
            language,
            eval_method='unsupervised_min_sim_between_max_sim_to_1best',
            train_models=False,
            find_noise=True,
            is_oracle_inference_results=True,
            fixed_noise=False,
            noise_method='m'):
        if (train_models):
            logging.info('-' * 50)
            logging.info('Training process started')
            tp.train_parser_all_lng(language,
                                    is_train_dev_together,
                                    with_words=True)
            logging.info('Training process ended')

        if (find_noise and not fixed_noise):
            logging.info('-' * 50)
            logging.info('Optimal noise learning started')
            optimal_n.find_optimal_noise_per_language(
                eval_method=eval_method,
                specific_languages=language,
                noise_method=noise_method,
                weight_sim_1best=0.5,
                weight_sim_between=0.5)
            logging.info('Optimal noise learning ended')

        logging.info('-' * 50)
        logging.info('Noised dependency trees creation started')
        noise_maker.create_noised_dps_over_all_languages(
            language,
            is_train_dev_together=False,
            k_best_baseline=False,
            fixed_noise=fixed_noise,
            noise_method=noise_method)
        logging.info('Noised dependency trees creation ended')

        logging.info('-' * 50)
        logging.info('mst wrapper started')
        mst_wrapper.mst_wrapper_for_all_languages(
            language,
            final_file_name='UAS_perturbated_k_100_MLN_FULL_mono_lingual',
            is_train_dev_together=False,
            is_mst=True,
            given_one_file_repeated_sentnces=False)
        logging.info('mst wrapper ended')

        if (is_oracle_inference_results):
            logging.info('Oracle wrapper started')
            oracle_wrapper.oracle_wrapper_for_all_languages(
                language,
                final_file_name='UAS_perturbated_k_100_MLN_FULL_mono_lingual',
                is_train_dev_together=False)
            logging.info('Oracle wrapper ended')
        return language + " is ready"