Debian Codegraph @

bindings/node.js/src/test/build/spec.js

raw symbols SCIP
1 // Generated by CoffeeScript 1.7.0
2 describe('Link Grammar Tests', function() {
3 var LinkGrammar, linkGrammar, linkage;
4 LinkGrammar = require(__dirname + '/../../build/index.js');
5 require('should');
6 linkGrammar = new LinkGrammar();
7 linkage = linkGrammar.parse('turn off the light');
8 it('should have the correct number of links', function() {
9 linkage.links[2].left.word.should.equal('turn');
10 return linkage.links.length.should.equal(5);
11 });
12 it('should have the correct tree', function() {
13 return linkage.tree.child.child.label.should.equal('turn');
14 });
15 it('should have word list', function() {
16 return linkage.words.length.should.equal(6);
17 });
18 it('should get link list by label', function() {
19 linkage.linksByLabel('MV').length.should.equal(1);
20 return linkage.linksByLabel(/J/).length.should.equal(1);
21 });
22 return it('should get connector words', function() {
23 var connectors;
24 connectors = linkage.getConnectorWords('off');
25 connectors[0].source.label.should.equal('MVp');
26 connectors[0].target.label.should.equal('MV');
27 connectors[0].target.word.should.equal('turn');
28 connectors[0].target.type.should.equal('v');
29 connectors[1].source.label.should.equal('J');
30 connectors[1].target.label.should.equal('Jp');
31 connectors[1].target.word.should.equal('light');
32 return connectors[1].target.type.should.equal('n');
33 });
34 });