Java Code Examples for org.apache.uima.cas.FeatureStructure#toString()

The following examples show how to use org.apache.uima.cas.FeatureStructure#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CasDumpWriter.java    From uima-uimafit with Apache License 2.0 5 votes vote down vote up
private void processFeatureStructure(FeatureStructure aFS) {
  String meta = aFS.toString();
  for (String line : meta.split("\n")) {
    boolean print = false;
    for (InExPattern p : cookedFeaturePatterns) {
      p.matchter.reset(line);
      if (p.matchter.matches()) {
        print = p.includeInOutput;
      }
    }
    if (print) {
      out.println(line);
    }
  }
}
 
Example 2
Source File: FSArray.java    From uima-uimaj with Apache License 2.0 3 votes vote down vote up
/**
 * Copies an array of Feature Structures to an Array of Strings.
 * The strings are the "toString()" representation of the feature structures, 
 * 
 * @param srcPos
 *                The index of the first element to copy.
 * @param dest
 *                The array to copy to.
 * @param destPos
 *                Where to start copying into <code>dest</code>.
 * @param length
 *                The number of elements to copy.
 * @exception ArrayIndexOutOfBoundsException
 *                    If <code>srcPos &lt; 0</code> or
 *                    <code>length &gt; size()</code> or
 *                    <code>destPos + length &gt; destArray.length</code>.
 */
@Override
public void copyToArray(int srcPos, String[] dest, int destPos, int length) {
  _casView.checkArrayBounds(theArray.length, srcPos, length);
  for (int i = 0; i < length; i++) {
    FeatureStructure fs = _maybeGetPearFs(theArray[i + srcPos]);
    dest[i + destPos] = (fs == null) ? null : fs.toString();
  }
}