dist/multilabel/BinarySegmentation.js
function(sentence, explain) {

		// sentence = "['start'] " + sentence + " ['end']"
		var minWordsToSplit = 2;
		var words = sentence.split(/ /);
		// var words = tokenizer.tokenize(sentence);
		if (this.segmentSplitStrategy && words.length>=minWordsToSplit) {
			var accumulatedClasses = {};
			var explanations = [];
			this.segmentSplitStrategy(words, accumulatedClasses, explain, explanations); 
			
			var classes = Object.keys(accumulatedClasses);

			return (explain>0?	{
				classes: classes, 
				explanation: explanations
			}: 
			classes);
		} else {
			classification = this.bestClassOfSegment(sentence, explain)
			// classification = this.classifySegment(sentence, explain);
			//HERER

			// console.log(sentence)
			// console.log(classification)
			// process.exit(0)
			// process.exit(0)

			return (explain>0?	{
				classes: classification[0], 
				// FEATURES
				explanation: [[classification[0], sentence, [0,sentence.length-1], classification[2]]]
				// explanation: [[classification[0], sentence, [0,sentence.length-1]]]

			}: 
			classification[0]);
			// return {classes: classification[0],
					// explanation: [[classification[0], sentence, [0,sentence.length-1]]]}
			// return {classes: classification.classes[0]}
		}
	}
function(sentence, explain) {

		// sentence = "['start'] " + sentence + " ['end']"
		var minWordsToSplit = 2;
		var words = sentence.split(/ /);
		// var words = tokenizer.tokenize(sentence);
		if (this.segmentSplitStrategy && words.length>=minWordsToSplit) {
			var accumulatedClasses = {};
			var explanations = [];
			this.segmentSplitStrategy(words, accumulatedClasses, explain, explanations); 
			
			var classes = Object.keys(accumulatedClasses);

			return (explain>0?	{
				classes: classes, 
				explanation: explanations
			}: 
			classes);
		} else {
			classification = this.bestClassOfSegment(sentence, explain)
			// classification = this.classifySegment(sentence, explain);
			//HERER

			// console.log(sentence)
			// console.log(classification)
			// process.exit(0)
			// process.exit(0)

			return (explain>0?	{
				classes: classification[0], 
				// FEATURES
				explanation: [[classification[0], sentence, [0,sentence.length-1], classification[2]]]
				// explanation: [[classification[0], sentence, [0,sentence.length-1]]]

			}: 
			classification[0]);
			// return {classes: classification[0],
					// explanation: [[classification[0], sentence, [0,sentence.length-1]]]}
			// return {classes: classification.classes[0]}
		}
	}
function ( sentence , explain ) { // sentence = "['start'] " + sentence + " ['end']" var minWordsToSplit = 2 ; var words = sentence . split ( / / ) ; // var words = tokenizer.tokenize(sentence); if ( this . segmentSplitStrategy && words . length >= minWordsToSplit ) { var accumulatedClasses = { } ; var explanations = [ ] ; this . segmentSplitStrategy ( words , accumulatedClasses , explain , explanations ) ; var classes = Object . keys ( accumulatedClasses ) ; return ( explain > 0 ? { classes : classes , explanation : explanations } : classes ) ; } else { classification = this . bestClassOfSegment ( sentence , explain ) // classification = this.classifySegment(sentence, explain); //HERER // console.log(sentence) // console.log(classification) // process.exit(0) // process.exit(0) return ( explain > 0 ? { classes : classification [ 0 ] , // FEATURES explanation : [ [ classification [ 0 ] , sentence , [ 0 , sentence . length - 1 ] , classification [ 2 ] ] ] // explanation: [[classification[0], sentence, [0,sentence.length-1]]] } : classification [ 0 ] ) ; // return {classes: classification[0], // explanation: [[classification[0], sentence, [0,sentence.length-1]]]} // return {classes: classification.classes[0]} } }
Use the model trained so far to classify a new sample.

@param segment a part of a text sentence.
@param explain - int - if positive, an "explanation" field, with the given length, will be added to the result.

@return an array whose VALUES are classes.
Use the model trained so far to classify a new sample .