Example #1
0
def NaiveBayesPrepareFeatures(ctx, outFeaturesMaps, featuresBitMask):
    logging.getLogger("NaiveBayes").info("prepare features")
    MinerFeaturesUtils.initFeatures(ctx, outFeaturesMaps)
    if (featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.wordExists):
        MinerFeaturesUtils.addFeaturesWordExists(ctx, outFeaturesMaps)
    if (featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.commentLength):
        MinerFeaturesUtils.addFeaturesCommentLength(ctx, outFeaturesMaps)
    if (featuresBitMask
            & MinerFeaturesUtils.eFeaturesMaskBits.helpfullnessRatio):
        MinerFeaturesUtils.addFeaturesHelpfulnessRatio(ctx, outFeaturesMaps)
    if (featuresBitMask
            & MinerFeaturesUtils.eFeaturesMaskBits.authorFreqInReview):
        MinerFeaturesUtils.addFeaturesAuthorFreqInReview(ctx, outFeaturesMaps)
    if (featuresBitMask
            & MinerFeaturesUtils.eFeaturesMaskBits.reviewAuthorMentioned):
        MinerFeaturesUtils.addFeaturesReviewAuthorMentioned(
            ctx, outFeaturesMaps)
    if (featuresBitMask
            & MinerFeaturesUtils.eFeaturesMaskBits.commentAuthorMentioned):
        MinerFeaturesUtils.addFeaturesCommentAuthorMentioned(
            ctx, outFeaturesMaps)
    if (featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.dist):
        MinerFeaturesUtils.addFeaturesDist(ctx, outFeaturesMaps)
    if (featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.phrases):
        MinerFeaturesUtils.addFeaturesPhrases(ctx, outFeaturesMaps)
def SvmPrepareFeatures( ctx, outFeaturesMaps ):
    logging.getLogger("Svm").info( "prepare features" )
    MinerFeaturesUtils.initFeatures( ctx, outFeaturesMaps )
    MinerFeaturesUtils.addFeaturesCommentLength( ctx, outFeaturesMaps )
    MinerFeaturesUtils.addFeaturesHelpfulnessRatio( ctx, outFeaturesMaps )
    MinerFeaturesUtils.addFeaturesPhrases( ctx, outFeaturesMaps )
    MinerFeaturesUtils.addFeaturesWordExists( ctx, outFeaturesMaps )
    MinerFeaturesUtils.addFeaturesAuthorFreqInReview(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesReviewAuthorMentioned(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesCommentAuthorMentioned( ctx, outFeaturesMaps )
    MinerFeaturesUtils.addFeaturesCAR( ctx, outFeaturesMaps )
Example #3
0
def SvmPrepareFeatures(ctx, outFeaturesMaps):
    logging.getLogger("Svm").info("prepare features")
    MinerFeaturesUtils.initFeatures(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesCommentLength(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesHelpfulnessRatio(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesPhrases(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesWordExists(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesAuthorFreqInReview(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesReviewAuthorMentioned(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesCommentAuthorMentioned(ctx, outFeaturesMaps)
    MinerFeaturesUtils.addFeaturesCAR(ctx, outFeaturesMaps)
def NaiveBayesPrepareFeatures( ctx, outFeaturesMaps, featuresBitMask ):
    logging.getLogger("NaiveBayes").info( "prepare features" )
    MinerFeaturesUtils.initFeatures( ctx, outFeaturesMaps )
    if ( featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.wordExists ):
        MinerFeaturesUtils.addFeaturesWordExists( ctx, outFeaturesMaps )
    if ( featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.commentLength ):
        MinerFeaturesUtils.addFeaturesCommentLength( ctx, outFeaturesMaps )
    if ( featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.helpfullnessRatio ):
        MinerFeaturesUtils.addFeaturesHelpfulnessRatio( ctx, outFeaturesMaps )
    if ( featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.authorFreqInReview ):
        MinerFeaturesUtils.addFeaturesAuthorFreqInReview(ctx, outFeaturesMaps)
    if ( featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.reviewAuthorMentioned ):
        MinerFeaturesUtils.addFeaturesReviewAuthorMentioned(ctx, outFeaturesMaps)
    if ( featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.commentAuthorMentioned ):
        MinerFeaturesUtils.addFeaturesCommentAuthorMentioned( ctx, outFeaturesMaps )
    if ( featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.dist ):
        MinerFeaturesUtils.addFeaturesDist( ctx, outFeaturesMaps )
    if ( featuresBitMask & MinerFeaturesUtils.eFeaturesMaskBits.phrases ):
        MinerFeaturesUtils.addFeaturesPhrases( ctx, outFeaturesMaps )