Skip to content

Commit

Permalink
Completed CLI recommender
Browse files Browse the repository at this point in the history
  • Loading branch information
limcheekin committed Dec 15, 2011
1 parent 7f0f760 commit de58533
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 58 deletions.
45 changes: 45 additions & 0 deletions scripts/Recommender.groovy
@@ -0,0 +1,45 @@
/* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
*
* @author <a href='mailto:limcheekin@vobject.com'>Lim Chee Kin</a>
*
* @since 0.5
*/
import org.apache.mahout.cf.taste.impl.eval.LoadEvaluator

includeTargets << new File("${mahoutRecommenderPluginDir}/scripts/_RecommenderBuilderInput.groovy")

target(main: "run recommender") {
depends(acceptInput)

ant.input(message:"Enter user id:", addproperty:"userId")
userID = ant.antProject.properties["userId"] as Long

ant.input(message:"Enter number of recommendations return:", addproperty:"howMany", defaultvalue: MahoutRecommenderConstants.DEFAULT_HOW_MANY)
howMany = ant.antProject.properties["howMany"] as Integer

recommender = MahoutRecommenderSupport.getRecommender(recommenderSelected, hasPreference, similarity, withWeighting, neighborhood)

items = recommender.recommend(userID, howMany)

println "Recommended Item(s): $items.size"
items.eachWithIndex { item, i ->
println "\t$i) $item.itemID - $item.value"
}
}

setDefaultTarget(main)
58 changes: 0 additions & 58 deletions scripts/RunRecommender.groovy

This file was deleted.

0 comments on commit de58533

Please sign in to comment.