mflbackend/src/helpers.py
def make_identifier(lexicon, baseform, pos, field='', default=False):
    """ Suggest an identifier for an entry
    Args:
        lexicon (str): the name of the lexicon in which the identifier
            should be used
        baseform (str): the entry's baseform
        pos (str): the entry's word class
        field (str, optional): the identier's field name.
            Defaults to the lexicon config's value.
        default (bool, optional): always create a standard uuid, even if the
            lexicon has got a function for creating identifiers.
            Defaults to false.
    """
    lexconf = lexconfig.get_lexiconconf(lexicon)
    func = extra_src(lexicon, 'yield_identifier', None)

    if default or func is None:
        return str(uuid.uuid1())

    field = field or lexconf['identifier']
    mode = lexconf['lexiconMode']

    for _id in func(baseform, pos):
        if check_identifier(_id, field, lexicon, mode, fail=False):
            return _id

    raise errs.MflException("Could not come up with an identifier for %s, %s in lexicon %s" %
                            (baseform, pos, lexicon),
                            code="id_generation")
 Suggest an identifier for an entry
    Args:
        lexicon (str): the name of the lexicon in which the identifier
            should be used
        baseform (str): the entry's baseform
        pos (str): the entry's word class
        field (str, optional): the identier's field name.
            Defaults to the lexicon config's value.
        default (bool, optional): always create a standard uuid, even if the
            lexicon has got a function for creating identifiers.
            Defaults to false.
    
Suggest an identifier for an entry
Suggest an identifier for an entry
def make_identifier(lexicon, baseform, pos, field='', default=False):
    lexconf = lexconfig.get_lexiconconf(lexicon)
    func = extra_src(lexicon, 'yield_identifier', None)
    if default or func is None:
        return str(uuid.uuid1())
    field = field or lexconf['identifier']
    mode = lexconf['lexiconMode']
    for _id in func(baseform, pos):
        if check_identifier(_id, field, lexicon, mode, fail=False):
            return _id
    raise errs.MflException("Could not come up with an identifier for %s, %s in lexicon %s" %
                            (baseform, pos, lexicon),
                            code="id_generation")
def make_identifier ( lexicon , baseform , pos , field = '' , default = False ) : lexconf = lexconfig . get_lexiconconf ( lexicon ) func = extra_src ( lexicon , 'yield_identifier' , None ) if default or func is None : return str ( uuid . uuid1 ( ) ) field = field or lexconf [ 'identifier' ] mode = lexconf [ 'lexiconMode' ] for _id in func ( baseform , pos ) : if check_identifier ( _id , field , lexicon , mode , fail = False ) : return _id raise errs . MflException ( "Could not come up with an identifier for %s, %s in lexicon %s" % ( baseform , pos , lexicon ) , code = "id_generation" )
Suggest an identifier for an entry
Suggest an identifier for an entry
""" Suggest an identifier for an entry
    Args:
        lexicon (str): the name of the lexicon in which the identifier
            should be used
        baseform (str): the entry's baseform
        pos (str): the entry's word class
        field (str, optional): the identier's field name.
            Defaults to the lexicon config's value.
        default (bool, optional): always create a standard uuid, even if the
            lexicon has got a function for creating identifiers.
            Defaults to false.
    """
lexicon
the name of the lexicon in which the identifier
should be used
the name of the lexicon in which the identifier should be used
baseform
the entry's baseform
the entry ' s baseform
pos
the entry's word class
the entry ' s word class
field
the identier's field name.
Defaults to the lexicon config's value.
the identier ' s field name . Defaults to the lexicon config ' s value .
default
always create a standard uuid, even if the
lexicon has got a function for creating identifiers.
Defaults to false.
always create a standard uuid even if the lexicon has got a function for creating identifiers . Defaults to false .