2023-03-04 12:19:01 +00:00
|
|
|
package nu.marginalia.converting;
|
2022-05-19 15:45:26 +00:00
|
|
|
|
2022-09-10 18:28:45 +00:00
|
|
|
import com.google.gson.Gson;
|
2022-05-19 15:45:26 +00:00
|
|
|
import com.google.inject.AbstractModule;
|
|
|
|
import com.google.inject.name.Names;
|
2023-03-04 12:19:01 +00:00
|
|
|
import nu.marginalia.LanguageModels;
|
|
|
|
import nu.marginalia.WmsaHome;
|
|
|
|
import nu.marginalia.model.gson.GsonFactory;
|
2022-05-19 15:45:26 +00:00
|
|
|
|
|
|
|
public class ConverterModule extends AbstractModule {
|
|
|
|
|
2023-07-14 15:08:10 +00:00
|
|
|
public ConverterModule() {
|
2022-05-19 15:45:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void configure() {
|
|
|
|
bind(Gson.class).toInstance(createGson());
|
|
|
|
|
|
|
|
bind(Double.class).annotatedWith(Names.named("min-document-quality")).toInstance(-15.);
|
2022-07-18 23:42:17 +00:00
|
|
|
bind(Integer.class).annotatedWith(Names.named("min-document-length")).toInstance(250);
|
2022-05-19 15:45:26 +00:00
|
|
|
bind(Integer.class).annotatedWith(Names.named("max-title-length")).toInstance(128);
|
|
|
|
bind(Integer.class).annotatedWith(Names.named("max-summary-length")).toInstance(255);
|
|
|
|
|
2022-06-03 11:32:05 +00:00
|
|
|
bind(LanguageModels.class).toInstance(WmsaHome.getLanguageModels());
|
2022-05-19 15:45:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private Gson createGson() {
|
2022-09-10 18:28:45 +00:00
|
|
|
return GsonFactory.get();
|
2022-05-19 15:45:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|