org.ujmp.core.Matrix.getAsString()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.ujmp.core.Matrix.getAsString()方法的一些代码示例,展示了Matrix.getAsString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.getAsString()方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:getAsString

Matrix.getAsString介绍

暂无

代码示例

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long row, long column) {
  return matrix.getAsString(row, column);
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  String s = getSource().getAsString(coordinates);
  if (s == null) {
    return null;
  } else {
    return s.toLowerCase();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  String s = getSource().getAsString(coordinates);
  if (s == null || method == null) {
    return null;
  } else {
    try {
      return (String) method.invoke(null, sourceLanguage, targetLanguage, s);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: jdmp/java-data-mining-package

private static Collection<?> getProductsInLine(Matrix data, long row) {
  Set<Object> products = new HashSet<Object>();
  for (int c = 1; c < data.getColumnCount(); c++) {
    String prod = data.getAsString(row, c);
    if (prod != null) {
      prod = prod.trim().intern();
      if (prod.length() != 0) {
        products.add(prod);
      }
    }
  }
  return products;
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  String src = getSource().getAsString(coordinates);
  return (src == null) ? null : searchPattern.matcher(src).replaceAll(replaceString);
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  return getSource().getAsString(coordinates);
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  String s = getSource().getAsString(coordinates);
  if (s == null) {
    return null;
  } else {
    return s.toUpperCase();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public static void toWriter(Writer writer, Matrix matrix, Object... parameters)
      throws IOException {
    String lineend = System.getProperty("line.separator");

    for (long[] c : matrix.availableCoordinates()) {
      writer.append(c[Matrix.ROW] + separator);
      writer.append(c[Matrix.COLUMN] + separator);
      writer.append(matrix.getAsString(c) + lineend);
    }
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  String s = getSource().getAsString(coordinates);
  if (s == null) {
    return null;
  } else {
    try {
      return new String(s.getBytes(), encoding);
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  String s = getSource().getAsString(coordinates);
  s = StringUtil.retainChars(s, allowedChars, ' ');
  s = s.replaceAll("\\s+", " ");
  return s;
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  String s = getSource().getAsString(coordinates).toLowerCase();
  StringBuilder result = new StringBuilder(s.length());
  String[] words = s.split("\\s+");
  for (int i = 0; i < words.length; i++) {
    String w = words[i];
    if (w.length() == 0) {
      continue;
    }
    result.append(stemmer.stem(w));
    if (i < words.length - 1) {
      result.append(" ");
    }
  }
  return result.toString();
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public String getString(long... coordinates) {
  String s = getSource().getAsString(coordinates);
  if (s != null) {
    StringBuilder result = new StringBuilder(s.length());
    String[] words = s.split("\\s+");
    for (int i = 0; i < words.length; i++) {
      String w = words[i];
      if (w.length() == 0) {
        continue;
      }
      if (!wordsToRemove.contains(w)) {
        result.append(w);
      }
      if (i < words.length - 1) {
        result.append(" ");
      }
    }
    return result.toString();
  } else {
    return "";
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public int getInt(long... coordinates) {
  String s = getSource().getAsString(coordinates);
  int index = dictionary.indexOf(s);
  return index;
}

代码示例来源:origin: jdmp/java-data-mining-package

public final ListMatrix<ListMatrix<String>> tokenize(Matrix input) throws Exception {
  ListMatrix<ListMatrix<String>> result = new DefaultListMatrix<ListMatrix<String>>();
  for (long[] c : input.availableCoordinates()) {
    String s = input.getAsString(c);
    result.addAll(tokenize(s));
  }
  return result;
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public DiscretizeDictionary(Matrix matrix, Dictionary dictionary) {
  super(matrix);
  this.dictionary = dictionary;
  if (!dictionary.isFixed()) {
    for (long[] c : getSource().availableCoordinates()) {
      dictionary.add(getSource().getAsString(c));
    }
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public ArrayDenseStringMatrix2D(Matrix source) {
  this(MathUtil.longToInt(source.getRowCount()), MathUtil.longToInt(source.getColumnCount()));
  for (long[] c : source.availableCoordinates()) {
    setAsString(source.getAsString(c), c);
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
public void testImportPDFFile() throws Exception {
  File file = File.createTempFile("test", ".pdf");
  ResourceUtil.copyToFile(PDFRESOURCE, file);
  assertTrue(file.exists());
  Matrix m = Matrix.Factory.importFrom().file(file).asPDF();
  String s = m.getAsString(0, 0);
  assertEquals("test", s.trim());
  file.delete();
  assertFalse(file.exists());
}

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
  public void testStringTranspose() {
    Matrix m1 = new DefaultDenseStringMatrix2D(2, 1);
    m1.setAsString("string1", 0, 0);
    m1.setAsString("string2", 1, 0);
    Matrix m2 = m1.transpose();
    assertEquals("string1", m2.getAsString(0, 0));
    assertEquals("string2", m2.getAsString(0, 1));
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public DefaultDenseStringMatrix2D(Matrix m) {
  super(m.getRowCount(), m.getColumnCount());
  this.rows = MathUtil.longToInt(m.getRowCount());
  this.cols = MathUtil.longToInt(m.getColumnCount());
  if (m instanceof DefaultDenseStringMatrix2D) {
    String[] v = ((DefaultDenseStringMatrix2D) m).values;
    this.values = new String[v.length];
    System.arraycopy(v, 0, this.values, 0, v.length);
  } else {
    this.values = new String[rows * cols];
    for (long[] c : m.allCoordinates()) {
      setString(m.getAsString(c), c);
    }
  }
  if (m.getMetaData() != null) {
    setMetaData(m.getMetaData().clone());
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
  public void testImportPDFStream() throws Exception {
    InputStream is = ResourceUtil.getResourceAsStream(PDFRESOURCE);

    Matrix m = Matrix.Factory.importFrom().stream(is).asPDF();

    String s = m.getAsString(0, 0);
    assertEquals("test", s.trim());
  }
}

相关文章

Matrix类方法