Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package it.uniroma2.art.coda.test.ae;
 
 
 
	public static final String PERSON_ARRAY = "personArray";
	private String [] personArray;
	public void process(JCas aJCasthrows AnalysisEngineProcessException {
		Pattern patter = Pattern.compile("\\b([A-Z]?[a-z]+)\\s([A-Z]?[a-z]+)\\b");
		String text = aJCas.getDocumentText();
		Matcher matcher = patter.matcher(text);
		if( == null || .==0){
			// the array is null or has no element, so there is no reason to execute the matcher
			return;
		}
		int count = 0;
		int pos = 0;
		//while(matcher.find(count)){
		while(pos<text.length() && matcher.find(pos)){
			String textFound = matcher.group();
			for(int i=0; i<.; ++i){
				String currentPerson = [i].toLowerCase();
				if(currentPerson.compareToIgnoreCase(textFound) == 0){
					ComplexPerson complexPerson = new ComplexPerson(aJCas);
					complexPerson.setBegin(matcher.start());
					complexPerson.setEnd(matcher.end());
					CompleteName completeName = new CompleteName(aJCas);
					completeName.setFirstName(matcher.group(1));
					completeName.setLastName(matcher.group(2));
					complexPerson.setName(completeName);
					complexPerson.addToIndexes();
					pos = matcher.start() + matcher.group(1).length()+1; 
					break// the person has been found, so skip to the next word
					//continue;
				}
			}
			pos += matcher.group(1).length()+1;
			count = count+matcher.group(1).length()+1;
		}
	}
New to GrepCode? Check out our FAQ X