Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

outfactor our nlp

  • Loading branch information...
commit 782f3236334d02224b1b7396a84fb78e045bbeb9 1 parent 302f95c
@obra authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 app/scripts/rei.js
View
14 app/scripts/rei.js
@@ -57,23 +57,27 @@ define(
initialize: function(pluginNames) {
this.initializePlugins(pluginNames);
},
-
+ getTokens: function (input) {
+ var lex = new Pos.Lexer().lex(input);
+ var tokens = new Pos.Tagger().tag(lex);
+ return tokens;
+ },
handleQuery: function(input) {
var that = this;
var responses = {};
- var tokens = new Pos.Lexer().lex(input);
- var tags = new Pos.Tagger().tag(tokens);
+ var tokens = Rei.getTokens(input);
- jQuery.each(tags, function(idx, tag) {
+ jQuery.each(tokens, function(idx, tag) {
// stem each token in the list of token+POS
// and add the stem to the end of the list
// yielding [token, POS, stem]
tag.push(Stemmer.stem(tag[0]));
});
+
var args = {
rawInput: input,
- tokens: tags,
+ tokens: tokens,
jQuery: jQuery,
sessionStorage: that.sessionStorage,
persistentStorage: that.storage
Please sign in to comment.
Something went wrong with that request. Please try again.