show the probabilities for the alternative translations

This commit is contained in:
kr.angelov
2014-04-24 07:44:47 +00:00
parent e28cb48e51
commit 80e249105f

View File

@@ -132,7 +132,7 @@ public class AlternativesActivity extends ListActivity {
expandedView = view;
}
private void expandExpr(View view, Expr expr) {
private void expandExpr(View view, ExprProb ep) {
ImageView arrow = (ImageView) view.findViewById(R.id.arrow);
arrow.setImageResource(R.drawable.close_arrow);
@@ -146,7 +146,8 @@ public class AlternativesActivity extends ListActivity {
((RelativeLayout) view).addView(inflectionView, params);
}
inflectionView.loadData(expr.toString(), "text/plain; charset=UTF-8", null);
String content = String.format("[%.4f] %s", ep.getProb(), ep.getExpr());
inflectionView.loadData(content, "text/plain; charset=UTF-8", null);
expandedView = view;
}
@@ -189,9 +190,9 @@ public class AlternativesActivity extends ListActivity {
});
} else {
if (item instanceof ExprProb) {
final Expr expr = ((ExprProb) item).getExpr();
final ExprProb ep = (ExprProb) item;
String phrase = mTranslator.linearize(expr);
String phrase = mTranslator.linearize(ep.getExpr());
if (phrase.startsWith("% ") || phrase.startsWith("* ") || phrase.startsWith("+ "))
phrase = phrase.substring(2);
@@ -203,10 +204,10 @@ public class AlternativesActivity extends ListActivity {
if (expandedView == view)
collapse();
else if (expandedView == null)
expandExpr(view, expr);
expandExpr(view, ep);
else {
collapse();
expandExpr(view, expr);
expandExpr(view, ep);
}
}
});