/// <summary> Initializes the Chart-based Morphological Analyzer plug-in.</summary> /// <param name="baseDir">- the path for base directory, which should have the 'conf' and 'data' directory /// </param> /// <param name="configFile">- the path for the configuration file (relative path to the base directory) /// </param> public virtual void initialize(System.String baseDir, System.String configFile) { JSONReader json = new JSONReader(configFile); fileDicSystem = baseDir + "/" + json.getValue("dic_system"); fileDicUser = baseDir + "/" + json.getValue("dic_user"); fileConnections = baseDir + "/" + json.getValue("connections"); fileConnectionsNot = baseDir + "/" + json.getValue("connections_not"); fileDicAnalyzed = baseDir + "/" + json.getValue("dic_analyzed"); fileTagSet = baseDir + "/" + json.getValue("tagset"); tagSet = new TagSet(); tagSet.init(fileTagSet, TagSet.TAG_SET_KAIST); connection = new Connection(); connection.init(fileConnections, tagSet.TagCount, tagSet); connectionNot = new ConnectionNot(); connectionNot.init(fileConnectionsNot, tagSet); analyzedDic = new AnalyzedDic(); analyzedDic.readDic(fileDicAnalyzed); systemDic = new Trie(Trie.DEFAULT_TRIE_BUF_SIZE_SYS); systemDic.read_dic(fileDicSystem, tagSet); userDic = new Trie(Trie.DEFAULT_TRIE_BUF_SIZE_USER); userDic.read_dic(fileDicUser, tagSet); numDic = new NumberDic(); simti = new Simti(); simti.init(); eojeolList = new LinkedList < Eojeol >(); chart = new MorphemeChart(tagSet, connection, systemDic, userDic, numDic, simti, eojeolList); postProc = new PostProcessor(); }
/// <summary> Constructor.</summary> /// <param name="tagSet">- the morpheme tag set /// </param> /// <param name="connection">- the morpheme connection rules /// </param> /// <param name="systemDic">- the system morpheme dictionary /// </param> /// <param name="userDic">- the user morpheme dictionary /// </param> /// <param name="numDic">- the number dictionary /// </param> /// <param name="simti">- the SIMple Trie Index /// </param> /// <param name="resEojeolList">- the list of eojeols to store the analysis result /// </param> public MorphemeChart(TagSet tagSet, Connection connection, Trie systemDic, Trie userDic, NumberDic numDic, Simti simti, LinkedList<Eojeol> resEojeolList) { chart = new Morpheme[MAX_MORPHEME_CHART]; for (int i = 0; i < MAX_MORPHEME_CHART; i++) { chart[i] = new Morpheme(this); } this.sp = new SegmentPosition(); this.tagSet = tagSet; this.connection = connection; this.exp = new Exp(this, tagSet); this.systemDic = systemDic; this.userDic = userDic; this.numDic = numDic; this.simti = simti; this.resEojeols = resEojeolList; resMorphemes = new List<String>(); resTags = new List<String>(); chiReplacementList = new LinkedList<String>(); engReplacementList = new LinkedList<String>(); }