MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / getSafeNames

Method getSafeNames

JSAT/src/jsat/io/CSV.java:845–867  ·  view source on GitHub ↗
(CategoricalData[] cats, char delimiter)

Source from the content-addressed store, hash-verified

843
844
845 private static String[][] getSafeNames(CategoricalData[] cats, char delimiter)
846 {
847 String[][] catNamesToUse = new String[cats.length][];
848 final char delim_replacement;
849 if(delimiter == '_')//avoid setting the replacment to the deliminater value itself!
850 delim_replacement = '-';
851 else
852 delim_replacement = '_';
853 for(int i = 0; i < catNamesToUse.length; i++)
854 {
855 catNamesToUse[i] = new String[cats[i].getNumOfCategories()];
856 for(int j = 0; j < catNamesToUse[i].length; j++)
857 {
858 String name = cats[i].getOptionName(j).trim();
859
860 if(name.contains(String.valueOf(delimiter)))
861 name = name.replace(delimiter, delim_replacement);
862
863 catNamesToUse[i][j] = name;
864 }
865 }
866 return catNamesToUse;
867 }
868
869 private static boolean isNewLine(char ch)
870 {

Callers 2

writeMethod · 0.95
getWriterMethod · 0.95

Calls 3

getNumOfCategoriesMethod · 0.80
getOptionNameMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected