public Builder stopwordsFile(String stopwordsFile) throws MalformedURLException { if (stopwordsFile.isEmpty()) { this.stopwordsFile = Optional.empty(); return this; } else { return stopwordsFile(new File(stopwordsFile)); } }
@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); ParallelTopicModel model; try { getLogger().info("Loading model file " + modelLocation); model = ParallelTopicModel.read(modelLocation); if (maxTopicAssignments <= 0) { maxTopicAssignments = model.getNumTopics() / 10; } } catch (Exception e) { throw new ResourceInitializationException(e); } getLogger().info("Model loaded."); inferencer = model.getInferencer(); malletPipe = new TokenSequence2FeatureSequence(model.getAlphabet()); try { sequenceGenerator = new PhraseSequenceGenerator.Builder() .featurePath(tokenFeaturePath) .minTokenLength(minTokenLength) .lowercase(lowercase) .buildStringSequenceGenerator(); } catch (IOException e) { throw new ResourceInitializationException(e); } }
sequenceGenerator = new PhraseSequenceGenerator.Builder() .characters(useCharacters) .minTokenLength(minTokenLength) .stopwordsFile(stopwordsFile) .stopwordsReplacement(stopwordsReplacement) .featurePath(tokenFeaturePath) .filterRegex(filterRegex) .filterRegexReplacement(filterRegexReplacement) .coveringType(coveringAnnotationType) .lowercase(lowercase) .buildStringSequenceGenerator();
@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); try { sequenceGenerator = new PhraseSequenceGenerator.Builder() .featurePath(featurePath) .filterRegex(numberRegex) .filterRegexReplacement(NUMBER_REPLACEMENT) .stopwordsFile(stopwordsFile) .stopwordsReplacement(STOPWORD_REPLACEMENT) .coveringType(coveringType) .buildStringSequenceGenerator(); } catch (IOException e) { throw new ResourceInitializationException(e); } }
protected StringSequenceGenerator(PhraseSequenceGenerator.Builder builder) throws IOException { psg = builder.build(); }
public Builder stopwordsFile(String stopwordsFile) throws MalformedURLException { if (stopwordsFile.isEmpty()) { this.stopwordsFile = Optional.empty(); return this; } else { return stopwordsFile(new File(stopwordsFile)); } }
protected StringSequenceGenerator(PhraseSequenceGenerator.Builder builder) throws IOException { psg = builder.build(); }