public static void initRandomCas(JCas aJCas,int aTextSize,int aAnnotationCount,long aSeed){
  List<Type> types=new ArrayList<Type>();
  types.add(getType(aJCas,Token.class));
  types.add(getType(aJCas,Sentence.class));
  Random rnd=new Random(aSeed);
  for (int n=0; n < 10; n++) {
    Type t=types.remove(rnd.nextInt(types.size()));
    types.add(t);
  }
  aJCas.setDocumentText(RandomStringUtils.random(aTextSize));
  CAS cas=aJCas.getCas();
  for (int n=0; n < aAnnotationCount; n++) {
    Type t=types.get(n % types.size());
    int length=rnd.nextInt(30);
    int begin=rnd.nextInt(aTextSize);
    int end=begin + length;
    if (end > aTextSize) {
      n--;
      continue;
    }
    cas.addFsToIndexes(cas.createAnnotation(t,begin,end));
  }
}

public static void initRandomCas ( JCas aJCas , int aTextSize , int aAnnotationCount , long aSeed ) { List < Type > types = new ArrayList < Type > ( ) ; types . add ( getType ( aJCas , Token . class ) ) ; types . add ( getType ( aJCas , Sentence . class ) ) ; Random rnd = new Random ( aSeed ) ; for ( int n = 0 ; n < 10 ; n ++ ) { Type t = types . remove ( rnd . nextInt ( types . size ( ) ) ) ; types . add ( t ) ; } aJCas . setDocumentText ( RandomStringUtils . random ( aTextSize ) ) ; CAS cas = aJCas . getCas ( ) ; for ( int n = 0 ; n < aAnnotationCount ; n ++ ) { Type t = types . get ( n % types . size ( ) ) ; int length = rnd . nextInt ( 30 ) ; int begin = rnd . nextInt ( aTextSize ) ; int end = begin + length ; if ( end > aTextSize ) { n -- ; continue ; } cas . addFsToIndexes ( cas . createAnnotation ( t , begin , end ) ) ; } }
initializes a cas with random text , tokens , and sentences .
