Пример #1
0
def getTraitSelectorSeqFromProfile( profile, specifiedTraits, defaultWeight = 0.5 ):
	"converts a profile into a traitSelectorSequence based on the SpecifiedTraits"
	if specifiedTraits._d == PersonIdService.ALL_TRAITS:
		traitnames = SqlTraits.get_supported_trait_names()
	else:
		traitnames = specifiedTraits._v

	return [ PersonIdService.TraitSelector( trait, get_weight_for_trait(trait, defaultWeight, SqlTraits.default_weight_map) ) for trait in filter( lambda(t): t.name in traitnames and t.value.typecode().kind() == CORBA.tk_string and t.value.value().strip() <> '' , profile ) ]
Пример #2
0
def getTraitSelectorSeqFromProfile( profile, specifiedTraits =PersonIdService.SpecifiedTraits(PersonIdService.ALL_TRAITS, []), defaultWeight = 0.2 ):
	"converts a profile into a traitSelectorSequence based on the SpecifiedTraits"
	if specifiedTraits._d == PersonIdService.ALL_TRAITS:
		traitnames = SqlTraits.get_supported_trait_names()
	else:
		traitnames = specifiedTraits._v

	tSelSeq = []
	for trait in filter( lambda(t): t.name in traitnames and t.value.typecode().kind() == CORBA.tk_string and t.value.value().strip() <> '' , profile ) :
		tSelSeq.append(PersonIdService.TraitSelector( trait, defaultWeight))
Пример #3
0
def getTraitSelectorSeqFromProfile(
        profile,
        specifiedTraits=PersonIdService.SpecifiedTraits(
            PersonIdService.ALL_TRAITS, []),
        defaultWeight=0.2):
    "converts a profile into a traitSelectorSequence based on the SpecifiedTraits"
    if specifiedTraits._d == PersonIdService.ALL_TRAITS:
        traitnames = SqlTraits.get_supported_trait_names()
    else:
        traitnames = specifiedTraits._v

    tSelSeq = []
    for trait in filter(
            lambda (t): t.name in traitnames and t.value.typecode().kind() ==
            CORBA.tk_string and t.value.value().strip() <> '', profile):
        tSelSeq.append(PersonIdService.TraitSelector(trait, defaultWeight))
Пример #4
0
def getTraitSelectorSeqFromProfile(profile,
                                   specifiedTraits,
                                   defaultWeight=0.5):
    "converts a profile into a traitSelectorSequence based on the SpecifiedTraits"
    if specifiedTraits._d == PersonIdService.ALL_TRAITS:
        traitnames = SqlTraits.get_supported_trait_names()
    else:
        traitnames = specifiedTraits._v

    return [
        PersonIdService.TraitSelector(
            trait,
            get_weight_for_trait(trait, defaultWeight,
                                 SqlTraits.default_weight_map))
        for trait in filter(
            lambda (t): t.name in traitnames and t.value.typecode().kind() ==
            CORBA.tk_string and t.value.value().strip() <> '', profile)
    ]