Package opennlp.tools.util
Class DownloadUtil
- java.lang.Object
-
- opennlp.tools.util.DownloadUtil
-
public class DownloadUtil extends Object
This class facilitates the downloading of pretrained OpenNLP models.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DownloadUtil.ModelType
The type of model.
-
Field Summary
Fields Modifier and Type Field Description static Map<String,Map<DownloadUtil.ModelType,String>>
available_models
-
Constructor Summary
Constructors Constructor Description DownloadUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BaseModel
downloadModel(String language, DownloadUtil.ModelType modelType, Class type)
static BaseModel
downloadModel(URL url, Class type)
Downloads a model from a URL.
-
-
-
Field Detail
-
available_models
public static Map<String,Map<DownloadUtil.ModelType,String>> available_models
-
-
Method Detail
-
downloadModel
public static BaseModel downloadModel(String language, DownloadUtil.ModelType modelType, Class type) throws IOException
- Throws:
IOException
-
downloadModel
public static BaseModel downloadModel(URL url, Class type) throws IOException
Downloads a model from a URL. The model is saved to an .opennlp/ directory located under the user's home directory. This directory will be created if it does not already exist. If a model to be downloaded already exists in that directory, the model will not be re-downloaded.- Parameters:
url
- The model's URL.- Returns:
- A
TokenNameFinderModel
. - Throws:
IOException
- Thrown if the model cannot be downloaded.
-
-