本文整理汇总了Java中org.apache.uima.jcas.cas.StringArray.size方法的典型用法代码示例。如果您正苦于以下问题:Java StringArray.size方法的具体用法?Java StringArray.size怎么用?Java StringArray.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.uima.jcas.cas.StringArray
的用法示例。
在下文中一共展示了StringArray.size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSlotValues
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
public Collection<String> getSlotValues() {
Collection<String> slotValuesToReturn = new ArrayList<String>();
StringArray slotValues = wrappedSM.getSlotValues();
for (int i = 0; i < slotValues.size(); i++) {
slotValuesToReturn.add(slotValues.get(i));
}
return slotValuesToReturn;
}
示例2: swapDocumentInfo
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
public static void swapDocumentInfo(JCas fromJcas, GenericDocument toGD) {
FSIterator docInfoIter = fromJcas.getJFSIndexRepository().getAnnotationIndex(CCPDocumentInformation.type)
.iterator();
// print document information
String docID = "-1";
int docCollectionID = -1;
if (docInfoIter.hasNext()) {
CCPDocumentInformation docInfo = (CCPDocumentInformation) docInfoIter.next();
docID = docInfo.getDocumentID();
docCollectionID = docInfo.getDocumentCollectionID();
/* Get any secondary document IDs */
StringArray secondaryIDsArray = docInfo.getSecondaryDocumentIDs();
if (secondaryIDsArray != null) {
for (int i = 0; i < secondaryIDsArray.size(); i++) {
toGD.addSecondaryDocumentID(secondaryIDsArray.get(i));
}
}
}
toGD.setDocumentID(docID);
toGD.setDocumentCollectionID(docCollectionID);
// set the document text
toGD.setDocumentText(fromJcas.getDocumentText());
// add the annotations to the Generic Document
// UIMA_Util uimaUtil = new UIMA_Util();
List<TextAnnotation> annotations = getAnnotationsFromCas(fromJcas);
toGD.setAnnotations(annotations);
}
示例3: convertToCollection
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
private static Collection<String> convertToCollection(StringArray iArray) {
Collection<String> iCollection = new ArrayList<String>();
for (int i = 0; i < iArray.size(); i++) {
iCollection.add(iArray.get(i));
}
return iCollection;
}
示例4: indexOf
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
public static int indexOf(StringArray strArray, String strValue) {
if (strArray == null) {
return -1;
}
for (int i = 0; i < strArray.size(); i++) {
if (strArray.get(i).equals(strValue)) {
return i;
}
}
return -1;
}
示例5: getFirstSlotValue
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
public static String getFirstSlotValue(CCPStringSlotMention ccpSSM) {
StringArray slotArray = ccpSSM.getSlotValues();
if (slotArray != null && slotArray.size() > 0) {
return slotArray.get(0);
}
return null;
}
示例6: toList
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
public static List<String> toList(StringArray tokens) {
List<String> l = new ArrayList<String>(tokens.size());
for (int i = 0; i < tokens.size(); i++) {
l.add(tokens.get(i));
}
return l;
}
示例7: buildCssStyle
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
/**
* Create a CSS style string for the style annotation
*
* @param s
* the style
* @return the string
*/
private String buildCssStyle(final Style s) {
final String color = s.getColor();
final StringArray decorations = s.getDecoration();
final String font = s.getFont();
// If no style info stop
if (Strings.isNullOrEmpty(color) && Strings.isNullOrEmpty(font)
&& (decorations == null || decorations.size() == 0)) {
return null;
}
final StringBuilder sb = new StringBuilder();
// This is very naive, it a passthrough of the original formats values
// Effectively we are just hoping the browser knows what to do.
if (!Strings.isNullOrEmpty(color)) {
sb.append(String.format("color:%s; ", color));
}
if (!Strings.isNullOrEmpty(font)) {
sb.append(String.format("font-family:\"%s\"; ", color));
}
if (decorations != null && decorations.size() > 0) {
final String[] array = decorations.toArray();
for (final String a : array) {
switch (a.toUpperCase()) {
case "UNDERLINE":
sb.append("text-decoration:underline; ");
break;
case "BOLD":
sb.append("font-weight:bold; ");
break;
case "ITALIC":
case "ITALICS":
sb.append("font-style:italic; ");
break;
case "STRIKE":
case "STRIKETHROUGH":
sb.append("text-decoration: line-through; ");
break;
case "SUPERSCRIPT":
sb.append("font-size: .7em; vertical-align: super; ");
break;
case "SUBSCRIPT":
sb.append("font-size: .7em; vertical-align: sub; ");
break;
case "BIG":
sb.append("font-size: 1.2em; ");
break;
case "SMALL":
sb.append("font-size: .9em; ");
break;
case "highlighted":
sb.append("background-color:#ffffe0; ");
break;
default:
// No nothing - we don't know what it means
break;
}
}
}
return sb.toString();
}