Package opennlp.tools.util.model

Examples of opennlp.tools.util.model.BaseModel


    }

    protected BaseModel buildNameModel(String directoryPath, String modelType, URI typeUri, String i18nLanguageCode) throws IOException, ConfigurationException {
        String fname = OpenNLPUtil.OpenNlpModels.valueOf(modelType).filename();
        String modelRelativePath = i18nLanguageCode + fname;
        BaseModel model = OpenNLPUtil.loadModel(directoryPath, modelRelativePath, modelType);
        entityTypes.put(modelType, new Object[] { typeUri, model });
        return model;
    }
View Full Code Here


                List<SurfaceFormOccurrence> res = null;
                //TODO pass type information within SurfaceFormOccurrence to later stages
                String typeLabel = type.getKey();
                Object[] typeInfo = type.getValue();
                URI typeUri = (URI) typeInfo[0];
                BaseModel nameFinderModel = (BaseModel) typeInfo[1];
                res = extractNameOccurrences(nameFinderModel, text, typeUri);
                if (res != null && !res.isEmpty()) {
                    if (ret == null) {
                        ret = res;
                    }
View Full Code Here

    }

    public static BaseModel loadOpenNlpModel(String modelType, InputStream in) throws IOException {
        OpenNLPUtil.OpenNlpModels m = OpenNLPUtil.OpenNlpModels.valueOf(modelType);
        BaseModel mdl = loadgivenmodeltype( m, in);
        return mdl;
    }
View Full Code Here

            throw new ConfigurationException("Could not load OpenNLP Model file.");
        }
    }

    protected static BaseModel loadgivenmodeltype(OpenNlpModels m, InputStream in) throws InvalidFormatException, IOException {
        BaseModel mdl = null;
        switch(m) {
            case TokenizerModel: {
                mdl = new TokenizerModel(in);
                LOG.debug("OpenNLP5 Tokenizer Model loaded: " + mdl);
                break;
View Full Code Here

TOP

Related Classes of opennlp.tools.util.model.BaseModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.