mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
show the probabilities for the alternative translations
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user