Skip to content

Commit

Permalink
Sort by score
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDM committed Jul 20, 2014
1 parent b165a7f commit 07970c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/js/arethusa.hebrew_morph/hebrew_morph.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,19 @@ angular.module('arethusa.hebrewMorph').service('hebrewMorph', [

this.parse = function(xmlToken, token) {
var morph = new Morph(token.string);
var forms = [];
token.morphology = morph;
var analyses = arethusaUtil.toAry(xmlToken.analysis);
angular.forEach(analyses, function(anal, i) {
var form = new Form(anal._id, anal._score);
form.base = parseBase(anal);
form.prefix = parsePrefix(anal);
form.suffix = parseSuffix(anal, form, token.string);
morph.forms.push(form);
forms.push(form);
});
arethusaUtil.pushAll(morph.forms, forms.sort(function(a, b) {
return a.score < b.score;
}));
};

this.currentSelection = function() {
Expand Down

0 comments on commit 07970c7

Please sign in to comment.