def get_singles_bases(): src_group_word_form_list = get_string_list_from_file( 'src_dict/Добавить одиночки в БС.txt') for src_title_word_form in src_group_word_form_list: title_word_form = TitleWordForm(src_title_word_form, '', [], '') group_word_form = GroupWordForm(title_word_form, []) yield group_word_form
def get_group_word_form(src_dict: dict) -> GroupWordForm: name = src_dict['name'] info = [src_dict['Inf_0']] if src_dict['Inf_1']: info.append(''.join(list(filter(None, [ src_dict['Inf_1'], src_dict['Inf_2'], src_dict['Inf_3']])))) if src_dict['Inf_4']: info.append(''.join(list(filter(None, [ src_dict['Inf_4'], src_dict['Inf_5'], src_dict['Inf_6']])))) word_forms = [] if src_dict['Inf_1']: singl_word_forms = get_singl_word_forms(src_dict) word_forms += singl_word_forms if src_dict['Inf_4']: plurl_word_forms = get_plurl_word_forms( src_dict, singl_word_forms) word_forms += plurl_word_forms elif src_dict['Inf_4']: plurl_word_forms = get_plurl_word_forms(src_dict, []) word_forms += plurl_word_forms pprint(word_forms) title_word_form = TitleWordForm(name, word_forms[0].idf, info, '') return GroupWordForm(title_word_form, word_forms[1:])
def add_groups_to_bs(): """ 2 (продолжение). Соблюдая алфавитный порядок ЗС в док-те БС 15.01.21.txt, добавить в док-т БС 15.01.21.txt одиночки из док-та Добавить одиночки в БС 2.txt . 4. Соблюдая алфавитный порядок ЗС в БС, добавить в БС группы из док-тов Добавить группы в БС. Сущ-ные изм.txt и Добавить группы в БС. Сущ-ные 2.txt . """ word_forms_bases = list(read_src_bs('src_dict/БС 15.01.21.txt')) loners = get_string_list_from_file( 'src_dict/Добавить одиночки в БС 2.txt') loners_list = [] for loner in loners: title_word_form = TitleWordForm(loner, '', [], '') group_word_form = GroupWordForm(title_word_form, []) loners_list.append(group_word_form) modified_nouns = list(read_src_bs( 'src_dict/Добавить группы в БС. Сущ-ные изм.txt')) nouns_2 = list(read_src_bs('src_dict/Добавить группы в БС. Сущ-ные 2.txt', encoding='utf-8')) word_forms_bases += loners_list word_forms_bases += modified_nouns word_forms_bases += nouns_2 save_bs_dicts_to_txt(sorted(word_forms_bases), 'out/БС 15.01.21.txt')
def get_socket_group_word_form(src_dict: dict) -> GroupWordForm: name = src_dict['name'] info = [ src_dict['Inf_0'], ' '.join( list( filter(None, [ src_dict['Inf_1'], src_dict['Inf_2'], src_dict['Inf_3'], src_dict['Inf_4'], src_dict['Inf_5'], ]))) ] word_forms = [] adjectives_full_forms = get_full_forms(src_dict) word_forms += adjectives_full_forms if src_dict['Inf_1']: adjectives_short_forms = get_short_forms(src_dict) word_forms += adjectives_short_forms if src_dict['Inf_2']: adjectives_comparative_forms = get_comparative_forms(src_dict) word_forms += adjectives_comparative_forms if src_dict['Inf_3']: adjectives_superlative_forms = get_superlative_forms(src_dict) word_forms += adjectives_superlative_forms title_word_form = TitleWordForm(name, word_forms[0].idf, info, '') return GroupWordForm(title_word_form, word_forms[1:])
def get_bs_title_word_form(src_title_word_form): if '.*' in src_title_word_form: src_title_word_form_w_note, src_note = [ x.strip() for x in src_title_word_form.split(' .* ')] note = ' '.join(['.*', src_note]) else: src_title_word_form_w_note = src_title_word_form note = '' name, *idf_info, = src_title_word_form_w_note.split() if idf_info: idf, *info = idf_info else: idf, *info = '', '' return TitleWordForm(name, idf, info, note)
def get_group_word_form(src_dict: dict) -> GroupWordForm: name = src_dict['name'] info = [src_dict['Inf_0'], src_dict['Inf_1']] info += list( filter(None, [ src_dict['Inf_2'], src_dict['Inf_3'], src_dict['Inf_4'], src_dict['Inf_5'], src_dict['Inf_6'], src_dict['Inf_7'], src_dict['Inf_8'], src_dict['Inf_9'], src_dict['Inf_10'], src_dict['Inf_11'], src_dict['Inf_12'], ])) title_word_form = TitleWordForm(name, '.ГИ', info, '') word_forms = [] if src_dict['Inf_3']: present_future_forms = get_present_future_forms(src_dict) word_forms += present_future_forms if src_dict['Inf_4']: past_tense_forms = get_past_tense_forms(src_dict) word_forms += past_tense_forms if src_dict['Inf_5']: imperative_mood_forms = get_imperative_mood_forms(src_dict) word_forms += imperative_mood_forms if src_dict['Inf_6']: joint_action_forms = get_joint_action_forms(src_dict) word_forms += joint_action_forms if src_dict['Inf_7']: present_participle_is_valid_forms = get_present_participle_is_valid( src_dict) word_forms += present_participle_is_valid_forms if src_dict['Inf_8']: passive_present_participle_forms = get_passive_present_participle( src_dict) word_forms += passive_present_participle_forms if src_dict['Inf_9']: past_participle_is_valid_forms = get_past_participle_is_valid(src_dict) word_forms += past_participle_is_valid_forms if src_dict['Inf_10']: passive_past_participle_forms = get_passive_past_participle(src_dict) word_forms += passive_past_participle_forms if src_dict['Inf_11']: present_participle_forms = get_present_participle(src_dict) word_forms += present_participle_forms if src_dict['Inf_12']: past_participle_forms = get_past_participle(src_dict) word_forms += past_participle_forms return GroupWordForm(title_word_form, word_forms)