amalgame/commit

MINOR: factor out input_stats from mapping_stats

authorJacco van Ossenbruggen
Mon May 11 14:47:29 2015 +0200
committerJacco van Ossenbruggen
Mon May 11 14:47:29 2015 +0200
commitda586aeb985a7594fe91891797e32823f766ef8a
treec3b3bcef801544f2eb66ff5e60a2a5de2a44560b
parent221ca16fe5c532bf9073cccd6a9e2e019ea1a965
Diff style: patch stat
diff --git a/lib/amalgame/ag_stats.pl b/lib/amalgame/ag_stats.pl
index 04f09d4..159da56 100644
--- a/lib/amalgame/ag_stats.pl
+++ b/lib/amalgame/ag_stats.pl
@@ -67,7 +67,7 @@ node_counts(_, URL, Strategy, Stats, Options) :-
 	debug(mutex, 'Releasing mutex: ~w', [Mutex]).
 
 node_counts_(URL, Strategy, Stats) :-
-	expand_node(Strategy, URL, _Result), % this fills the cache
+	expand_node(Strategy, URL, _Result), % this should fill the cache
 	get_stats_cache(Strategy, URL, Stats),
 	is_dict(Stats).
 
@@ -100,7 +100,12 @@ mapping_stats(URL, Mapping, Strategy, Stats) :-
 	length(Ss, SN),	length(Ts, TN),
 
 	vocab_stats(URL, Strategy, SN, TN, VocStats, StructStats, CarthesianProductSize),
+	input_stats(URL, Strategy, SN, TN, MN, CarthesianProductSize, InputStats),
 
+	append([BasicStats, VocStats, StructStats, InputStats], StatsPairs),
+	dict_pairs(Stats,mapping_stats_dict, StatsPairs).
+
+input_stats(URL, Strategy, SN, TN, MN, CarthesianProductSize, InputStats) :-
 	InputStats = [
 	    sourcePercentageInput-SiPerc,
 	    targetPercentageInput-TiPerc,
@@ -126,9 +131,8 @@ mapping_stats(URL, Mapping, Strategy, Stats) :-
 	    save_perc(MN,CarthesianProductSize, IP),
 	    SiPerc = 0,
 	    TiPerc = 0
-	),
-	append([BasicStats, VocStats, StructStats, InputStats], StatsPairs),
-	dict_pairs(Stats,mapping_stats_dict, StatsPairs).
+	).
+
 
 vocab_stats(URL, Strategy, SN, TN, VocStats, StructStats, CarthesianProductSize) :-
 	mapping_vocab_sources(URL, Strategy, InputS, InputT),