Exemple #1
0
def expand_subposition_adv(last_adv, line, extra_tags):
#    print("+.adv", last_adv, file=sys.stderr)
    
    out_lines = []
    
    if " +cs=" in line:
        word = re_match(r" \+cs=([^ ]+)", line).group(1)
        word = word[:-2] + "е"
    else:
        word = main_word[:-2] + "е"

    if "adjp" in extra_tags:    
        extra_tags = re_sub(r":&?adjp(:pasv|:actv|:pres|:past|:perf|:imperf)+", "", extra_tags)

    
    w1 = compose_compar(word, last_adv, "adv:compr" + extra_tags)
    out_lines.append( w1 )
    
    adv_super = compose_compar("най" + word, last_adv, "adv:super" + extra_tags)
    adv_super2 = compose_compar("щонай" + word, last_adv, "adv:super" + extra_tags)
    adv_super3 = compose_compar("якнай" + word, last_adv, "adv:super" + extra_tags)
    out_lines.extend( (adv_super, adv_super2, adv_super3) )
    
#    print("...", w1, adv_super, file=sys.stderr)
    
    return out_lines
Exemple #2
0
def expand_subposition(main_word, line, extra_tags, idx):
    idx = ":xx" + str(idx)
    logger.debug("expanding sub " + idx + " " + main_word + ": " + line)
    if line.startswith(" +cs"):
        if " +cs=" in line:
            word = re_match(" \\+cs=([^ ]+)", line).group(1)
        else:
            word = main_word[:-2] + "іший"
            
        if "&adjp" in extra_tags:
            extra_tags = re_sub(r":&adjp(:pasv|:actv|:pres|:past|:perf|:imperf)+", "", extra_tags)


        word_forms = expand(word, "/adj :compr" + idx + extra_tags, flush_stdout)
#        word_forms[0] = DERIV_PADDING + word_forms[0]
        
        word = "най" + word
        word_forms_super = expand(word, "/adj :super" + idx + extra_tags, flush_stdout)
        word_forms.extend(word_forms_super)

        word_scho = "що" + word
        word_forms_super = expand(word_scho, "/adj :super" + idx + extra_tags, flush_stdout)
        word_forms.extend(word_forms_super)

        word_jak = "як" + word
        word_forms_super = expand(word_jak, "/adj :super" + idx + extra_tags, flush_stdout)
        word_forms.extend(word_forms_super)

        if not "-corp" in sys.argv:
            word_forms = [ replace_base(line, main_word) for line in word_forms ]
        
        return word_forms
 
    raise "Unknown subposition for " + line + "(" + main_word + ")"
Exemple #3
0
def expand_subposition_adv_main(main_word, line, extra_tags):
    logger.debug("expanding sub " + main_word + ": " + line + " extra tags: " + extra_tags)
    if line.startswith(" +cs"):
        if " +cs=" in line:
            word = re_match(" \\+cs=([^ ]+)", line).group(1)
        else:
            word = main_word[:-1] + "іше"
            
        adv_compr = compose_compar(word, main_word, "adv:compr" + extra_tags)
        adv_super = compose_compar("най" + word, main_word, "adv:super" + extra_tags)
        adv_super2 = compose_compar("щонай" + word, main_word, "adv:super" + extra_tags)
        adv_super3 = compose_compar("якнай" + word, main_word, "adv:super" + extra_tags)

        return [adv_compr, adv_super, adv_super2, adv_super3]
 
    raise "Unknown subposition for " + line + "(" + main_word + ")"