MCPcopy Index your code
hub / github.com/clns/node-commit-msg / parseSentence

Function parseSentence

lib/nlp-parser.js:99–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97 // java is available, use it
98 var res = [];
99 var parseSentence = function() {
100 var sentence = sentences[res.length];
101 if (!sentence) {
102 return processOutput(res.join('\n\n'));
103 }
104 parser.parse(sentence, function(err, tree) {
105 if (err) return cb(err);
106
107 var tokens = tree.taggedYieldSync();
108 var it = tokens.iteratorSync();
109 var tagging = [];
110 while (it.hasNextSync()) {
111 var token = it.nextSync();
112 tagging.push(token.toStringSync());
113 }
114 res.push([tagging.join(' ').trim(), tree.pennStringSync().trim()].join('\n\n'));
115 parseSentence();
116 });
117 };
118 parseSentence();
119 } else {
120 // use the java command instead

Callers 1

nlp-parser.jsFile · 0.85

Calls 2

processOutputFunction · 0.85
cbFunction · 0.85

Tested by

no test coverage detected