amalgame/commit

added evidence (stubs) for misc modules

authorJacco van Ossenbruggen
Sat Sep 7 14:00:35 2013 +0200
committerJacco van Ossenbruggen
Sat Sep 7 14:00:35 2013 +0200
commit6f23569243d4b671fbf2c8f29f69a068f16db7eb
treea6b8e76b4b742af47a8893256e84a73f04f62ec3
parent7d42743a1c31bc3f137cfc9522b091284e99f284
Diff style: patch stat
diff --git a/lib/ag_modules/most_generic.pl b/lib/ag_modules/most_generic.pl
index afbaffc..061ffcd 100644
--- a/lib/ag_modules/most_generic.pl
+++ b/lib/ag_modules/most_generic.pl
@@ -54,7 +54,9 @@ partition_(source, [A|As], Sel, Dis, Und) :-
 	),
 	partition_(source, Rest, SelRest, DisRest, UndRest).
 
-hierarchy_related([], _, G, G, []).
+hierarchy_related([], _, align(S,T,P), align(S,T,Pnew), []) :-
+	append(P, [[method(most_generic)]], Pnew).
+
 hierarchy_related([A|As], target, G0, G, [A1|Rest]) :-
 	A = align(_,T,_),
 	G0 = align(_,T0,_),
diff --git a/lib/ag_modules/most_methods.pl b/lib/ag_modules/most_methods.pl
index c311ae0..0d7f937 100644
--- a/lib/ag_modules/most_methods.pl
+++ b/lib/ag_modules/most_methods.pl
@@ -21,6 +21,10 @@ amalgame_module(amalgame:'MostMethods').
 selecter(AlignmentGraph, S, D, U, _Options) :-
 	partition_(AlignmentGraph, S, D, U).
 
+ap(align(S,T,P), align(S,T,Pnew)) :-
+	append(P, [[method(most_methods)]], Pnew).
+
+
 partition_([], [], [], []).
 partition_([align(S,T,P)|As], Sel, Dis, Und) :-
 	same_source(As, S, Same, Rest),
@@ -36,9 +40,11 @@ partition_([align(S,T,P)|As], Sel, Dis, Und) :-
 
 most_methods(As, Selected, [A|T]) :-
 	group_method_count(As, Counts),
-	sort(Counts, [N-Selected,N1-A|T0]),
+	sort(Counts, [N-Selected0,N1-A|T0]),
 	pairs_values(T0, T),
-	\+ N == N1.
+	\+ N == N1,
+	maplist(ap, [Selected0], [Selected]).
+
 
 group_method_count([], []).
 group_method_count([Align|As], [Count-Align|Ts]) :-
diff --git a/lib/ag_modules/sibling_selecter.pl b/lib/ag_modules/sibling_selecter.pl
index 4cb63d5..c8487e0 100644
--- a/lib/ag_modules/sibling_selecter.pl
+++ b/lib/ag_modules/sibling_selecter.pl
@@ -21,7 +21,7 @@ amalgame_module(amalgame:'SiblingSelecter').
 %
 %
 
-selecter(AlignmentGraph, Sel, [], Und, Options) :-
+selecter(AlignmentGraph, SelP, [], Und, Options) :-
 	option(depth(Depth), Options, 2),
 	option(type(SourceOrTarget), Options, source),
 	(   SourceOrTarget = target
@@ -30,7 +30,11 @@ selecter(AlignmentGraph, Sel, [], Und, Options) :-
 	    partition_(SourceOrTarget, SortedAlignmentGraph, Depth, Sel0, Und0),
 	    predsort(ag_map:compare_align(source), Sel0,  Sel),
 	    predsort(ag_map:compare_align(source), Und0,  Und)
-	).
+	),
+	maplist(ap, Sel, SelP).
+
+ap(align(S,T,P), align(S,T,Pnew)) :-
+	append(P, [[method(sibling_select)]], Pnew).
 
 
 
diff --git a/lib/ag_modules/snowball_match.pl b/lib/ag_modules/snowball_match.pl
index 8a3899a..3f93d00 100644
--- a/lib/ag_modules/snowball_match.pl
+++ b/lib/ag_modules/snowball_match.pl
@@ -102,11 +102,12 @@ match(align(Source, Target, Prov0), align(Source, Target, [Prov|Prov0]), Options
 	;   literal_distance(SourceStem, TargetStem, Distance),
 	    Distance =< Edit_Distance
 	),
+	Match is 1 / (1 + Distance),
 	Prov = [method(snowball),
 		prefix(Prefix),
 		source_stem(SourceStem),
 		target_stem(TargetStem),
-		literal_distance(Distance),
+		match(Match),
 		graph([rdf(Source, SourceProp, literal(lang(SourceLang, SourceLabel))),
 		       rdf(Target, TargetProp, literal(lang(TargetLang, TargetLabel)))])
 	       ],