@Override public Set<String> getOutcomeNames() { if (outcomeNames == null) { outcomeNames = new TreeSet<String>(); for (int i = 0; i < this.model.getNumOutcomes(); i++) { outcomeNames.add(this.model.getOutcome(i)); } } return outcomeNames; }
public BeamSearch(int size, BeamSearchContextGenerator<T> cg, MaxentModel model, SequenceValidator<T> validator, int cacheSize) { this.size = size; this.cg = cg; this.model = model; this.validator = validator; if (cacheSize > 0) { contextsCache = new Cache(cacheSize); } this.probs = new double[model.getNumOutcomes()]; }
public void init(NamedList initArgs) { SolrParams params = SolrParams.toSolrParams(initArgs); String modelDirectory = params.get("modelDirectory", System.getProperty("model.dir"));//<co id="qqpp.model"/> String wordnetDirectory = params.get("wordnetDirectory", System.getProperty("wordnet.dir"));//<co id="qqpp.wordnet"/> if (modelDirectory != null) { File modelsDir = new File(modelDirectory); try { InputStream chunkerStream = new FileInputStream( new File(modelsDir,"en-chunker.bin")); ChunkerModel chunkerModel = new ChunkerModel(chunkerStream); chunker = new ChunkerME(chunkerModel); //<co id="qqpp.chunker"/> InputStream posStream = new FileInputStream( new File(modelsDir,"en-pos-maxent.bin")); POSModel posModel = new POSModel(posStream); tagger = new POSTaggerME(posModel); //<co id="qqpp.tagger"/> model = new DoccatModel(new FileInputStream( //<co id="qqpp.theModel"/> new File(modelDirectory,"en-answer.bin"))) .getChunkerModel(); probs = new double[model.getNumOutcomes()]; atcg = new AnswerTypeContextGenerator( new File(wordnetDirectory, "dict"));//<co id="qqpp.context"/> } catch (IOException e) { throw new RuntimeException(e); } } } /*