Distributions Strings_to_Distributions (Strings me) {
	try {
		autoDistributions thee = Distributions_create (my numberOfStrings, 1);
		long idist = 0;
		for (long i = 1; i <= my numberOfStrings; i ++) {
			wchar *string = my strings [i];
			long where = 0;
			long j = 1;
			for (; j <= idist; j ++)
				if (wcsequ (thy rowLabels [j], string))
					{ where = j; break; }
			if (where) {
				thy data [j] [1] += 1.0;
			} else {
				thy rowLabels [++ idist] = Melder_wcsdup (string);
				thy data [idist] [1] = 1.0;
			}
		}
		thy numberOfRows = idist;
		TableOfReal_sortByLabel (thee.peek(), 1, 0);
		return thee.transfer();
	} catch (MelderError) {
		Melder_throw (me, ": distribution not computed.");
	}
}
Esempio n. 2
0
Distributions Distributions_addTwo (Distributions me, Distributions thee) {
	try {
		autoDistributions him = static_cast<Distributions> (TablesOfReal_append (me, thee));
		TableOfReal_sortByLabel (him.peek(), 0, 0);
		unicize (him.peek());
		return him.transfer();
	} catch (MelderError) {
		Melder_throw (me, U" & ", thee, U": not added.");
	}
}
Esempio n. 3
0
Distributions Distributions_addMany (Collection me) {
	try {
		autoDistributions thee = static_cast<Distributions> (TablesOfReal_appendMany (me));
		TableOfReal_sortByLabel (thee.peek(), 0, 0);
		unicize (thee.peek());
		return thee.transfer();
	} catch (MelderError) {
		Melder_throw (U"Distributions objects not added.");
	}
}
Esempio n. 4
0
autoDistributions Distributions_addMany (OrderedOf<structDistributions>* me) {
	try {
		autoDistributions thee = TablesOfReal_appendMany ((OrderedOf<structTableOfReal>*) me).static_cast_move<structDistributions>();   // FIXME cast
		TableOfReal_sortByLabel (thee.peek(), 0, 0);
		unicize (thee.peek());
		return thee;
	} catch (MelderError) {
		Melder_throw (U"Distributions objects not added.");
	}
}