mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -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;
|
expandedView = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expandExpr(View view, Expr expr) {
|
private void expandExpr(View view, ExprProb ep) {
|
||||||
ImageView arrow = (ImageView) view.findViewById(R.id.arrow);
|
ImageView arrow = (ImageView) view.findViewById(R.id.arrow);
|
||||||
arrow.setImageResource(R.drawable.close_arrow);
|
arrow.setImageResource(R.drawable.close_arrow);
|
||||||
|
|
||||||
@@ -146,7 +146,8 @@ public class AlternativesActivity extends ListActivity {
|
|||||||
((RelativeLayout) view).addView(inflectionView, params);
|
((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;
|
expandedView = view;
|
||||||
}
|
}
|
||||||
@@ -189,9 +190,9 @@ public class AlternativesActivity extends ListActivity {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (item instanceof ExprProb) {
|
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("+ "))
|
if (phrase.startsWith("% ") || phrase.startsWith("* ") || phrase.startsWith("+ "))
|
||||||
phrase = phrase.substring(2);
|
phrase = phrase.substring(2);
|
||||||
|
|
||||||
@@ -203,10 +204,10 @@ public class AlternativesActivity extends ListActivity {
|
|||||||
if (expandedView == view)
|
if (expandedView == view)
|
||||||
collapse();
|
collapse();
|
||||||
else if (expandedView == null)
|
else if (expandedView == null)
|
||||||
expandExpr(view, expr);
|
expandExpr(view, ep);
|
||||||
else {
|
else {
|
||||||
collapse();
|
collapse();
|
||||||
expandExpr(view, expr);
|
expandExpr(view, ep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user