I follow this topic and use MemoryIDMigrator to get a long ID for my products : Mahout : To read a custom input file
But I can't initialize IDMigrator like this because the parent constructor need to come first :
public MemoryIDMigrator memoryIDMigrator;
public CustomFileDataModel(File dataFile) throws IOException {
this.memoryIDMigrator = new MemoryIDMigrator();
super(dataFile);
}
@Override
protected long readItemIDFromString(String stringID) {
long result = this.memoryIDMigrator.toLongID(stringID);
this.memoryIDMigrator.storeMapping(result, stringID);
return result;
}
How could I give this parameter to get back my String ID ? I need something like this :
List<RecommendedItem> recommendations = recommender.recommend(2, 5);
for (RecommendedItem recommendation : recommendations) {
System.out.println(memoryIDMigrator.toStringID(recommendation.getItemID());
}