% the scoring is based on the frequency of each fact.

% Input is a list of ClaI-[EI1-TI1, EI2-TI2, ...]
% Output is a list of EI-[TI-score] -- then output into fact. candidateH_score(EI,TI,Score).
% ??? at the end, sort it based on the score or not?
%	You'll only need the max one -- later the score will be updated if you remove the covered examples.



/*% also need to traverse the EIs TIs, although it is a 
scoreTheories([],[]):-
scoreTheories([ClaI-EIsTIs|CountedRecords],ScoredEIsTIs):-
	scoreTheories(CountedRecords,PreScoredEIsTIs), */





scoreOneTheory(ClaCountedTree,{EI_any,TI_any,T}):-
	maplist(scoreOneCla(ClaCountedTree),T,ScoreList),
	multiplyList(ScoreList,TScore),
	portray_clause(candidateH_score(EI_any,TI_any,ScoreList,TScore)).


scoreOneCla(ClaCountedTree,ClaI,ClaScore):-
	rb_lookup(ClaI,EI_List,ClaCountedTree),
	length(EI_List,CoveredPosNum),
	set(posDataSize,TotalPosSize),
	ClaScore is CoveredPosNum/TotalPosSize.




	
	