Exemplo n.º 1
0
def add_SUBCAT_to_Num(word):
    # Assign feature SUBCAT to numbers lacking it using surface
    # form-based heuristics.

    fmap = word.feat_map()

    if 'SUBCAT' in fmap or word.postag != 'Num':
        return []

    t = numtype(word.form)

    if t == CARDINAL:
        return [('SUBCAT', 'Card')]
    elif t == ORDINAL:
        return [('SUBCAT', 'Ord')]
    else:
        return []
Exemplo n.º 2
0
def add_SUBCAT_to_Num(word):
    # Assign feature SUBCAT to numbers lacking it using surface
    # form-based heuristics.

    fmap = word.feat_map()

    if 'SUBCAT' in fmap or word.postag != 'Num':
        return []

    t = numtype(word.form)

    if t == CARDINAL:
        return [('SUBCAT', 'Card')]
    elif t == ORDINAL:
        return [('SUBCAT', 'Ord')]
    else:
        return []
def rewrite_Num(word):
    value = word.feat_map().get('SUBCAT')

    if value == 'Card':
        return 'NUM'
    elif value == 'Ord':
        return 'ADJ'

    # surface form-based heuristics
    t = numtype(word.form)

    if t == CARDINAL:
        return 'NUM'
    elif t == ORDINAL:
        # not quite sure about this, gives e.g. 1./ADJ
        warn('assigning ADJ to "ordinal": ' + word.form)
        return 'ADJ'
    elif t is None:
        warn(word.cpostag + u' without SUBCAT Card or Ord:' + word.form)
        # default to NUM (TODO: avoid guessing)
        return 'NUM'
    else:
        assert False, 'internal error'
Exemplo n.º 4
0
def rewrite_Num(word):
    value = word.feat_map().get('SUBCAT')

    if value == 'Card':
        return 'NUM'
    elif value == 'Ord':
        return 'ADJ'

    # surface form-based heuristics
    t = numtype(word.form)

    if t == CARDINAL:
        return 'NUM'
    elif t == ORDINAL:
        # not quite sure about this, gives e.g. 1./ADJ
        warn('assigning ADJ to "ordinal": ' + word.form)
        return 'ADJ'
    elif t is None:
        warn(word.cpostag + u' without SUBCAT Card or Ord:' + word.form)
        # default to NUM (TODO: avoid guessing)
        return 'NUM'
    else:
        assert False, 'internal error'