Package opennlp.tools.util
Klasse DownloadUtil
java.lang.Object
opennlp.tools.util.DownloadUtil
This class facilitates the downloading of pretrained OpenNLP models.
-
Verschachtelte Klassen - Übersicht
Verschachtelte Klassen -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic <T extends BaseModel>
TdownloadModel(String language, DownloadUtil.ModelType modelType, Class<T> type) Triggers a download for the specifiedDownloadUtil.ModelType.static <T extends BaseModel>
TdownloadModel(URL url, Class<T> type) Downloads a model from aURL.static Map<String, Map<DownloadUtil.ModelType, String>>
-
Konstruktordetails
-
DownloadUtil
public DownloadUtil()
-
-
Methodendetails
-
downloadModel
public static <T extends BaseModel> T downloadModel(String language, DownloadUtil.ModelType modelType, Class<T> type) throws IOException Triggers a download for the specifiedDownloadUtil.ModelType.- Typparameter:
T- The generic type which is a subclass ofBaseModel.- Parameter:
language- The ISO language code of the requested model.modelType- Thetypeof model.type- The class of the resulting model.- Gibt zurück:
- A model instance of type
DownloadUtil. - Löst aus:
IOException- Thrown if IO errors occurred or the model is invalid.
-
downloadModel
Downloads a model from aURL.The model is saved to an
.opennlp/directory located in 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.- Typparameter:
T- The generic type which is a subclass ofBaseModel.- Parameter:
url- The model'sURL.type- The class of the resulting modelDownloadUtil.- Gibt zurück:
- A model instance of type
DownloadUtil. - Löst aus:
IOException- Thrown if the model cannot be downloaded.
-
getAvailableModels
-