source: other-projects/the-macronizer/trunk/src/main/java/org/atea/nlptools/macroniser/monogram/model/ModelFactory.java@ 35791

Last change on this file since 35791 was 35791, checked in by cstephen, 3 years ago

Add updated macroniser code. This is a significant change to the codebase:

  • Servlets now send JSON responses that are easier to consume from other services.
  • Error responses are better conveyed and more infomative.
  • Monogram components have been touched up. They now bubble errors up and, where applicable, implement relevant interfaces.
  • The JSP interface has been removed
  • The SQL logging functionality has been deleted. It wasn't used before.
  • Dependencies updated.
File size: 1.4 KB
Line 
1package org.atea.nlptools.macroniser.monogram.model;
2
3import org.atea.nlptools.macroniser.util.Pool;
4
5/**
6 * The monogram factory opens a new pool worker thread that is used to build two monogram models.
7 * One for the macron data and one for the double vowel data.
8 * When the pool thread is done this it clears the pool.
9 *
10 * @see MonogramModel
11 *
12 * @author University of Waikato - Te Whare Wānanga o Waikato
13 * @version 1.0
14 * @since 2014-11-20
15 */
16public class ModelFactory
17{
18 private final static MonogramModel macronModel;
19 private final static MonogramModel doubleVowelModel;
20 private final static ListModel blackList;
21
22 static
23 {
24 final Pool<String> pool = new Pool<String>();
25 macronModel = new MonogramModel("../data/macron", pool);
26 doubleVowelModel = new MonogramModel("../data/doublevowel", pool);
27 blackList = new ListModel("../data/list/blacklist.data");
28 pool.clear();
29 }
30
31 private ModelFactory() {
32 // Hide constructor.
33 }
34
35 /** monogram model for macron data (/data/macron) */
36 public static MonogramModel getMacronModel() {
37 return macronModel;
38 }
39
40 /** Monogram model for double vowel data (/data/doubleVowel) */
41 public static MonogramModel getDoubleVowelModel() {
42 return doubleVowelModel;
43 }
44
45 /** Monogram model for black list data (/data/blacklist) */
46 public static ListModel getBlackList() {
47 return blackList;
48 }
49}
Note: See TracBrowser for help on using the repository browser.