Example #1
0
def expand_prefix(word, affixFlag, affixGroups):
    words = []

    for affixGroup in affixGroups.values():
      if affixGroup.matches(word):
        for affix in affixGroup.affixes:
          words.append( affix.apply(word) )

    return words
Example #2
0
def expand_prefix(word, affixFlag, affixGroups):
    words = []

    for affixGroup in affixGroups.values():
        if affixGroup.matches(word):
            for affix in affixGroup.affixes:
                words.append(affix.apply(word))

    return words
Example #3
0
def generate_suffix(word, affixFlag, affixGroups, allAffixFlags, origAffixFlags):
    addTag = ''
    lines = []

    if affixFlag == allAffixFlags[0]:
        base_line = get_word_base(word, affixFlag, allAffixFlags)
        if base_line != '':
            lines.append(base_line)

    for affixGroup in affixGroups.values():

      if affixGroup.matches(word):
         for affix in affixGroup.affixes:
            deriv = affix.apply(word)
            
            if( affixFlag == 'W' and not word.endswith('ти') ):
                lines.append( deriv + ' ' + deriv + ' ' + 'adv' )
#            elif 'advp' in affix.tags:
#                lines.append( deriv + ' ' + deriv + ' ' + affix.tags )
            else:
                # по-батькові
                if affixFlag == 'p':
                    if 'm:v_naz' in affix.tags:
                        patronim_base_m = deriv
                    elif 'f:v_naz' in affix.tags:
                        patronim_base_f = deriv
                        
                    if ':m:' in affix.tags:
                        word_base = patronim_base_m
                    elif ':f:' in affix.tags:
                        word_base = patronim_base_f
                    else:
                        word_base = patronim_base_m   # odd case for plurals, TODO: fix or remove plural patronim
                elif affixFlag in "BDFHJLNP" and word.endswith('ти'):
                    word_base = word + 'ся'
                else:
                    word_base = word
                    
                
                ln = deriv + ' ' + word_base + ' ' + affix.tags
                
                if firstname(word, affixFlag, allAffixFlags):
                     ln += ':fname'

                lines.append(ln)

    return lines
Example #4
0
def generate_suffix(word, affixFlag, affixGroups, allAffixFlags,
                    origAffixFlags):
    addTag = ''
    lines = []

    if affixFlag == allAffixFlags[0]:
        base_line = get_word_base(word, affixFlag, allAffixFlags)
        if base_line != '':
            lines.append(base_line)

    for affixGroup in affixGroups.values():

        if affixGroup.matches(word):
            for affix in affixGroup.affixes:
                deriv = affix.apply(word)

                if (affixFlag == 'W' and not word.endswith('ти')):
                    lines.append(deriv + ' ' + deriv + ' ' + 'adv')
#            elif 'advp' in affix.tags:
#                lines.append( deriv + ' ' + deriv + ' ' + affix.tags )
                else:
                    # по-батькові
                    if affixFlag == 'p':
                        if 'm:v_naz' in affix.tags:
                            patronim_base_m = deriv
                        elif 'f:v_naz' in affix.tags:
                            patronim_base_f = deriv

                        if ':m:' in affix.tags:
                            word_base = patronim_base_m
                        elif ':f:' in affix.tags:
                            word_base = patronim_base_f
                        else:
                            word_base = patronim_base_m  # odd case for plurals, TODO: fix or remove plural patronim
                    elif affixFlag in "BDFHJLNP" and word.endswith('ти'):
                        word_base = word + 'ся'
                    else:
                        word_base = word

                    ln = deriv + ' ' + word_base + ' ' + affix.tags

                    if firstname(word, affixFlag, allAffixFlags):
                        ln += ':fname'

                    lines.append(ln)

    return lines