summaryrefslogtreecommitdiff
path: root/tests/test_analyzer.js
blob: d003f8f6d7fe426200a723cac955a28f9f3b1708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var base = require('./base');

var data = [
["#a hello there #b", ["a", "b"], [["a", "b", "hello there"]],
["#a hello there2 #ba", ["a", "ba"], ["a", "ba", "hello there2"]]],
["#c and #d like #e", ["c", "d", "e"], [["c", "e", "like"], ["d", "e", "like"]]],
["#f and #g and #h are cool", ["f", "g", "h", "are cool"], [["f", "are cool", ""], ["g", "are cool", ""], ["h", "are cool", ""]]], // the are should be a label actually, but harder to do.
["#i likes #j and #k", ["i", "j", "k"], ["i", "j", "likes"], ["i", "k", "likes"]],
["#q likes #r but doesn't like #l", ["q", "r", "l"], []],
];
/*
#t and #u like #v
#w #x #y
sometimes #z and #ab aren't friends
I like to work with #a
*/

base.run_tests({
    done: function (errors, window) {
        debugger;
        if (process.argv.length > 2) {
            window.analyzeSentence(process.argv.slice(2).join(" "), true);
            dump_graphviz(window);
        } else {
            for (var k in data) {
                var sentence = data[k][0];
                var expected_nodes = data[k][1];
                var expected_links = data[k][2];
                window.analyzeSentence(sentence, true);
                // TODO - compare graphs
            }
        }
        process.exit();
    }
});