amalgame/commit

IMPROVED: evidence tracking on negative results

authorJacco van Ossenbruggen
Tue Aug 26 13:04:56 2014 +0200
committerJacco van Ossenbruggen
Tue Aug 26 13:04:56 2014 +0200
commitcd48227a897b8e806a064fe6cda8b79de508df1c
treec3890cf96b9b9c0c87f3cac24a60daad769a5996
parent16ec17d6b555cc97079f3bd3eda46e62ee172bb8
Diff style: patch stat
diff --git a/lib/ag_modules/arity_select.pl b/lib/ag_modules/arity_select.pl
index fd1512e..b2a8759 100644
--- a/lib/ag_modules/arity_select.pl
+++ b/lib/ag_modules/arity_select.pl
@@ -28,7 +28,7 @@ selecter(Mapping, Sel, Dis, [], Options) :-
 ap(Result, Arity, align(S,T,P), align(S,T,NP)) :-
 	NP = [NewP|P],
 	NewP = [method(ambiguity_remover),
-		score([result(Result), condition(Arity)])
+		score([result(Result), type(Arity)])
 	       ].
 
 %%	select_1_1(+Mapping, -Mapping_1_1, -Rest)
@@ -40,8 +40,8 @@ select_1_1(Mapping, Sel, Dis) :-
 	select_1_n_raw(Mapping, Target1, TargetN),
 	ord_intersection(Source1, Target1, Sel0),
 	ord_union(SourceN, TargetN, Dis0),
-	maplist(ap(selected, 1-1), Sel0, Sel),
-	maplist(ap(discarded,1-1), Dis0, Dis).
+	maplist(ap(selected, both), Sel0, Sel),
+	maplist(ap(discarded,both), Dis0, Dis).
 
 %%	select_n_1(+Mapping, -Mapping_n_1, -Rest)
 %
@@ -49,8 +49,8 @@ select_1_1(Mapping, Sel, Dis) :-
 %	only one target.
 select_n_1(Mapping, Sel, Dis) :-
 	select_n_1_raw(Mapping, Sel0, Dis0),
-	maplist(ap(selected, n-1), Sel0, Sel),
-	maplist(ap(discarded,n-1), Dis0, Dis).
+	maplist(ap(selected, source), Sel0, Sel),
+	maplist(ap(discarded,source), Dis0, Dis).
 
 %%	select_1_n(+Mapping, -Mapping_1_n, -Rest)
 %
@@ -61,8 +61,8 @@ select_1_n(Mapping, Sel, Dis) :-
 	select_1_n_raw(TargetSorted, Sel0, Dis0),
 	predsort(ag_map:compare_align(source),Sel0, Sel1),
 	predsort(ag_map:compare_align(source),Dis0, Dis1),
-	maplist(ap(selected, 1-n), Sel1, Sel),
-	maplist(ap(discarded,1-n), Dis1, Dis).
+	maplist(ap(selected, target), Sel1, Sel),
+	maplist(ap(discarded,target), Dis1, Dis).
 
 select_n_1_raw([], [], []).
 select_n_1_raw([align(S,T,P)|As], A1, A2) :-
diff --git a/lib/ag_modules/most_methods.pl b/lib/ag_modules/most_methods.pl
index e45887a..1b3c354 100644
--- a/lib/ag_modules/most_methods.pl
+++ b/lib/ag_modules/most_methods.pl
@@ -34,10 +34,11 @@ selecter(AlignmentGraph, S, D, U, Options) :-
 	predsort(ag_map:compare_align(source), Disc0, D),
 	predsort(ag_map:compare_align(source), Und0,  U).
 
-ap(Result, Most, SecondMost, align(S,T,P), align(S,T,Pnew)) :-
+ap(Type, Result, Most, SecondMost, align(S,T,P), align(S,T,Pnew)) :-
 	append(P, [[method(most_methods),
 		    score([ result(Result),
 			    most(Most),
+			    type(Type),
 			    second(SecondMost)])]],
 	       Pnew).
 
@@ -45,11 +46,12 @@ ap(Result, Most, SecondMost, align(S,T,P), align(S,T,Pnew)) :-
 partition_(_, [], [], [], []).
 partition_(source, [align(S,T,P)|As], Sel, Dis, Und) :-
 	same_target(As, T, Same, Rest),
-	(   most_methods([align(S,T,P)|Same], Selected, Discarded)
+	(   most_methods(source, [align(S,T,P)|Same], Selected, Discarded)
 	->  Sel = [Selected|SelRest],
 	    append(Discarded, DisRest, Dis),
 	    Und = UndRest
-	;   append([align(S,T,P)|Same], UndRest, Und),
+	;   Pu = [[method(most_methods), score([result(undecided), type(source)])]|P],
+	    append([align(S,T,Pu)|Same], UndRest, Und),
 	    Sel = SelRest,
 	    Dis = DisRest
 	),
@@ -57,24 +59,25 @@ partition_(source, [align(S,T,P)|As], Sel, Dis, Und) :-
 
 partition_(target, [align(S,T,P)|As], Sel, Dis, Und) :-
 	same_source(As, S, Same, Rest),
-	(   most_methods([align(S,T,P)|Same], Selected, Discarded)
+	(   most_methods(target, [align(S,T,P)|Same], Selected, Discarded)
 	->  Sel = [Selected|SelRest],
 	    append(Discarded, DisRest, Dis),
 	    Und = UndRest
-	;   append([align(S,T,P)|Same], UndRest, Und),
+	;   Pu = [[method(most_methods), score([result(undecided), type(target)])]|P],
+	    append([align(S,T,Pu)|Same], UndRest, Und),
 	    Sel = SelRest,
 	    Dis = DisRest
 	),
 	partition_(target, Rest, SelRest, DisRest, UndRest).
 
-most_methods(As, Selected, Discarded) :-
+most_methods(Type, As, Selected, Discarded) :-
 	group_method_count(As, Counts0),
 	sort(Counts0, Sorted),
 	append(T0, [SecondMost-A,Most-Selected0], Sorted),
 	Most \== SecondMost,
 	pairs_values(T0, T),
-	maplist(ap(selected, Most, SecondMost), [Selected0], [Selected]),
-	maplist(ap(discarded, Most, SecondMost), [A|T], Discarded).
+	maplist(ap(Type, selected, Most, SecondMost), [Selected0], [Selected]),
+	maplist(ap(Type, discarded, Most, SecondMost), [A|T], Discarded).
 
 group_method_count([], []).
 group_method_count([Align|As], [Count-Align|Ts]) :-