var chai = require('chai');
var expect = chai.expect;
chai.should();

var postagger = require('../../src/libnlp').postagger;

describe('postagger', function () {

  it('should assign part of speech tags to a text', function () {
    var text = 'The Battle of Hastings was fought in 1066. It was ' +
               'part of the Norman Conquest of England.';

    var expected = [
      { token: 'The', tag: 'DT' },
      { token: 'Battle', tag: 'NNP' },
      { token: 'of', tag: 'IN' },
      { token: 'Hastings', tag: 'NNP' },
      { token: 'was', tag: 'VBD' },
      { token: 'fought', tag: 'VBN' },
      { token: 'in', tag: 'IN' },
      { token: '1066', tag: 'CD' },
      { token: '.', tag: 'SB' },
      { token: 'It', tag: 'PRP' },
      { token: 'was', tag: 'VBD' },
      { token: 'part', tag: 'NN' },
      { token: 'of', tag: 'IN' },
      { token: 'the', tag: 'DT' },
      { token: 'Norman', tag: 'NNP' },
      { token: 'Conquest', tag: 'NN' },
      { token: 'of', tag: 'IN' },
      { token: 'England', tag: 'NNP' },
      { token: '.', tag: 'SB' }
    ];

    var actual = postagger.tag(text);

    actual.should.eql(expected);
  });

});

@@ -1147,12 +1147,659 @@
 %0A  %7D);%0A%0A
+  it('should be trainable using a corpus', function () %7B%0A    var corpus = %5B%0A      %7B observation: 'The', state: 'DT' %7D,%0A      %7B observation: 'Battle', state: 'NNP' %7D,%0A      %7B observation: 'of', state: 'IN' %7D,%0A      %7B observation: 'Hastings', state: 'NNP' %7D,%0A      %7B observation: '.', state: 'SB' %7D%0A    %5D;%0A%0A    postagger.train(%5Bcorpus%5D);%0A%0A    var expected = %5B%0A      %7B token: 'The', tag: 'DT' %7D,%0A      %7B token: 'Battle', tag: 'NNP' %7D,%0A      %7B token: 'of', tag: 'IN' %7D,%0A      %7B token: 'Hastings', tag: 'NNP' %7D,%0A      %7B token: '.', tag: 'SB' %7D%0A    %5D;%0A%0A    var actual = postagger.tag('The Battle of Hastings.');%0A%0A    actual.should.eql(expected);%0A  %7D);%0A%0A
 %7D);%0A

Add unit test for train()