if (notNull(params.getRuleBasedTokenizer(), params.getTokenizerModel())) { throw new TerminateToolException(-1, "Either use rule based or statistical tokenizer!"); annConfig = AnnotationConfiguration.parse(params.getAnnotationConfig()); try { samples = new BratDocumentStream(annConfig, params.getBratDataDir(), params.getRecursive(), null); } catch (IOException e) { throw new TerminateToolException(-1, e.getMessage()); if (params.getSentenceDetectorModel() != null) { try { sentDetector = new SentenceDetectorME(new SentenceModel(params.getSentenceDetectorModel())); } catch (IOException e) { throw new TerminateToolException(-1, "Failed to load sentence detector model!", e); if (params.getTokenizerModel() != null) { try { tokenizer = new TokenizerME(new TokenizerModel(params.getTokenizerModel())); } catch (IOException e) { throw new TerminateToolException(-1, "Failed to load tokenizer model!", e); else if (params.getRuleBasedTokenizer() != null) { String tokenizerName = params.getRuleBasedTokenizer(); if (params.getNameTypes() != null) { String[] nameTypesArr = params.getNameTypes().split(","); if (nameTypesArr.length > 0) {
if (notNull(params.getRuleBasedTokenizer(), params.getTokenizerModel())) { throw new TerminateToolException(-1, "Either use rule based or statistical tokenizer!"); annConfig = AnnotationConfiguration.parse(params.getAnnotationConfig()); try { samples = new BratDocumentStream(annConfig, params.getBratDataDir(), params.getRecursive(), null); } catch (IOException e) { throw new TerminateToolException(-1, e.getMessage()); if (params.getSentenceDetectorModel() != null) { try { sentDetector = new SentenceDetectorME(new SentenceModel(params.getSentenceDetectorModel())); } catch (IOException e) { throw new TerminateToolException(-1, "Failed to load sentence detector model!", e); if (params.getTokenizerModel() != null) { try { tokenizer = new TokenizerME(new TokenizerModel(params.getTokenizerModel())); } catch (IOException e) { throw new TerminateToolException(-1, "Failed to load tokenizer model!", e); else if (params.getRuleBasedTokenizer() != null) { String tokenizerName = params.getRuleBasedTokenizer(); if (params.getNameTypes() != null) { String[] nameTypesArr = params.getNameTypes().split(","); if (nameTypesArr.length > 0) {
if (notNull(params.getRuleBasedTokenizer(), params.getTokenizerModel())) { throw new TerminateToolException(-1, "Either use rule based or statistical tokenizer!"); annConfig = AnnotationConfiguration.parse(params.getAnnotationConfig()); try { samples = new BratDocumentStream(annConfig, params.getBratDataDir(), params.getRecursive(), null); } catch (IOException e) { throw new TerminateToolException(-1, e.getMessage()); if (params.getSentenceDetectorModel() != null) { try { sentDetector = new SentenceDetectorME(new SentenceModel(params.getSentenceDetectorModel())); } catch (IOException e) { throw new TerminateToolException(-1, "Failed to load sentence detector model!", e); if (params.getTokenizerModel() != null) { try { tokenizer = new TokenizerME(new TokenizerModel(params.getTokenizerModel())); } catch (IOException e) { throw new TerminateToolException(-1, "Failed to load tokenizer model!", e); else if (params.getRuleBasedTokenizer() != null) { String tokenizerName = params.getRuleBasedTokenizer();