Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubles with text splitting #27

Open
MrRez opened this issue Aug 15, 2013 · 1 comment
Open

Troubles with text splitting #27

MrRez opened this issue Aug 15, 2013 · 1 comment

Comments

@MrRez
Copy link

MrRez commented Aug 15, 2013

If i try to split text which ends with the split object - index file will not be created.
For example: I have text, and i try to split it with ".", so if text ends with "." last element of the array it will be empty (even if there are spaces after, they will be trimmed with Fullproof engine). As a result callback in engine.open() doesn't execute

@MrRez
Copy link
Author

MrRez commented Aug 15, 2013

I have found solution for this trouble. I added another condition in the common-engine.js, after that function fullproof.TextInjector.prototype.inject began to look like this:

 fullproof.TextInjector.prototype.inject = function(text,value,callback) {
     var self = this;
     this.analyzer.getArray(text, function(array_of_words) {
     if (array_of_words.length > 0) {
        var synchro = fullproof.make_synchro_point(callback, array_of_words.length);
        for (var i=0; i<array_of_words.length; ++i) {
            var val = array_of_words[i];
            if (val instanceof fullproof.ScoredEntry) {
                val.value = val.value===undefined?value:val.value;
                self.index.inject(val.key, val, synchro); // the line number is the value stored
            } else {
                self.index.inject(array_of_words[i], value, synchro); // the line number is the value stored
            }
        }
     } else {

            callback('', value);
        }
    });
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant