本文整理汇总了C#中IMatrixData.GetCategoryRowValuesAt方法的典型用法代码示例。如果您正苦于以下问题:C# IMatrixData.GetCategoryRowValuesAt方法的具体用法?C# IMatrixData.GetCategoryRowValuesAt怎么用?C# IMatrixData.GetCategoryRowValuesAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMatrixData
的用法示例。
在下文中一共展示了IMatrixData.GetCategoryRowValuesAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
SingleChoiceWithSubParams p = param.GetSingleChoiceWithSubParams("Row");
int colInd = p.Value;
if (colInd < 0) {
processInfo.ErrString = "No categorical rows available.";
return;
}
MultiChoiceParam mcp = p.GetSubParameters().GetMultiChoiceParam("Values");
int[] inds = mcp.Value;
if (inds.Length < 1) {
processInfo.ErrString = "Please select at least two terms for merging.";
return;
}
string newTerm = param.GetStringParam("New term").Value;
if (newTerm.Length == 0){
processInfo.ErrString = "Please specify a new term.";
return;
}
string[] values = new string[inds.Length];
for (int i = 0; i < values.Length; i++) {
values[i] = mdata.GetCategoryRowValuesAt(colInd)[inds[i]];
}
HashSet<string> value = new HashSet<string>(values);
string[][] cats = mdata.GetCategoryRowAt(colInd);
string[][] newCat = new string[cats.Length][];
for (int i = 0; i < cats.Length; i++){
string[] w = cats[i];
bool changed = false;
for (int j = 0; j < w.Length; j++){
if (value.Contains(w[j])){
w[j] = newTerm;
changed = true;
}
}
if (changed){
Array.Sort(w);
}
newCat[i] = w;
}
mdata.SetCategoryRowAt(newCat, colInd);
}
示例2: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
SingleChoiceWithSubParams p = param.GetSingleChoiceWithSubParams("Row");
int colInd = p.Value;
if (colInd < 0){
processInfo.ErrString = "No categorical rows available.";
return;
}
MultiChoiceParam mcp = p.GetSubParameters().GetMultiChoiceParam("Values");
int[] inds = mcp.Value;
if (inds.Length == 0){
processInfo.ErrString = "Please select at least one term for filtering.";
return;
}
string[] values = new string[inds.Length];
for (int i = 0; i < values.Length; i++){
values[i] = mdata.GetCategoryRowValuesAt(colInd)[inds[i]];
}
HashSet<string> value = new HashSet<string>(values);
bool remove = param.GetSingleChoiceParam("Mode").Value == 0;
string[][] cats = mdata.GetCategoryRowAt(colInd);
List<int> valids = new List<int>();
for (int i = 0; i < cats.Length; i++){
bool valid = true;
foreach (string w in cats[i]){
if (value.Contains(w)){
valid = false;
break;
}
}
if ((valid && remove) || (!valid && !remove)){
valids.Add(i);
}
}
PerseusPluginUtils.FilterColumns(mdata, param, valids.ToArray());
}
示例3: GetParameters
public Parameters GetParameters(IMatrixData mdata, ref string errorString)
{
Parameters[] subParams = new Parameters[mdata.CategoryRowCount];
for (int i = 0; i < mdata.CategoryRowCount; i++) {
string[] values = mdata.GetCategoryRowValuesAt(i);
int[] sel = values.Length == 1 ? new[] { 0 } : new int[0];
subParams[i] =
new Parameters(new Parameter[]{
new MultiChoiceParam("Values", sel)
{Values = values, Help = "The value that should be present to discard/keep the corresponding row."}
});
}
return
new Parameters(new Parameter[]{
new SingleChoiceWithSubParams("Row"){
Values = mdata.CategoryRowNames, SubParams = subParams,
Help = "The categorical row that the filtering should be based on.", ParamNameWidth = 50, TotalWidth = 731
},
new StringParam("New term")
});
}
示例4: GetParameters
public Parameters GetParameters(IMatrixData mdata, ref string errorString)
{
Parameters[] subParams = new Parameters[mdata.CategoryRowCount];
for (int i = 0; i < mdata.CategoryRowCount; i++) {
string[] values = mdata.GetCategoryRowValuesAt(i);
int[] sel = values.Length == 1 ? new[]{0} : new int[0];
subParams[i] =
new Parameters(new Parameter[]{
new MultiChoiceParam("Values", sel)
{Values = values, Help = "The value that should be present to discard/keep the corresponding row."}
});
}
return
new Parameters(new Parameter[]{
new SingleChoiceWithSubParams("Row"){
Values = mdata.CategoryRowNames, SubParams = subParams,
Help = "The categorical row that the filtering should be based on.", ParamNameWidth = 50, TotalWidth = 731
},
new SingleChoiceParam("Mode"){
Values = new[]{"Remove matching columns", "Keep matching columns"},
Help =
"If 'Remove matching columns' is selected, rows having the values specified above will be removed while " +
"all other rows will be kept. If 'Keep matching columns' is selected, the opposite will happen."
},
PerseusPluginUtils.GetFilterModeParam(false)
});
}