Esempio n. 1
0
        /// <summary> Initializes the data structure for segment positions with given string.</summary>
        /// <param name="str">- the plain string to analyze
        /// </param>
        /// <param name="simti">- SIMple Trie Index
        /// </param>
        public virtual void  init(System.String str, Simti simti)
        {
            int prevIndex = 0;
            int nextIndex = 0;

            positionEnd = 0;
            prevIndex   = addPosition(POSITION_START_KEY);
            position[prevIndex].state = SP_STATE_M;

            System.String rev = "";
            for (int i = str.Length - 1; i >= 0; i--)
            {
                rev += str[i];
            }

            for (int i = 0; i < str.Length; i++)
            {
                char c = str[i];
                nextIndex = addPosition(c);
                setPositionLink(prevIndex, nextIndex);
                prevIndex = nextIndex;

                simti.insert(rev.Substring(0, (str.Length - i) - (0)).ToCharArray(), nextIndex);
            }

            /* for marking the end of the eojeol */
            setPositionLink(prevIndex, 0);
        }
Esempio n. 2
0
        /// <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();
        }
Esempio n. 3
0
        /// <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>();
        }
Esempio n. 4
0
 private void InitBlock(Simti enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Esempio n. 5
0
 public ST_NODE(Simti enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Esempio n. 6
0
 private void InitBlock(Simti enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
     node = new ST_NODE(enclosingInstance);
     free = new ST_FREE(enclosingInstance);
 }
Esempio n. 7
0
 public HEADI(Simti enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Esempio n. 8
0
        /// <summary> Initializes the data structure for segment positions with given string.</summary>
        /// <param name="str">- the plain string to analyze
        /// </param>
        /// <param name="simti">- SIMple Trie Index
        /// </param>
        public virtual void init(System.String str, Simti simti)
        {
            int prevIndex = 0;
            int nextIndex = 0;

            positionEnd = 0;
            prevIndex = addPosition(POSITION_START_KEY);
            position[prevIndex].state = SP_STATE_M;

            System.String rev = "";
            for (int i = str.Length - 1; i >= 0; i--)
            {
                rev += str[i];
            }

            for (int i = 0; i < str.Length; i++)
            {
                char c = str[i];
                nextIndex = addPosition(c);
                setPositionLink(prevIndex, nextIndex);
                prevIndex = nextIndex;

                simti.insert(rev.Substring(0, (str.Length - i) - (0)).ToCharArray(), nextIndex);
            }

            /* for marking the end of the eojeol */
            setPositionLink(prevIndex, 0);
        }
        /// <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();
        }
Esempio n. 10
0
 private void  InitBlock(Simti enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Esempio n. 11
0
 public ST_FREE(Simti enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Esempio n. 12
0
 private void  InitBlock(Simti enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
     s_free = new ST_FREE(enclosingInstance);
     s_node = new ST_NODE(enclosingInstance);
 }
Esempio n. 13
0
 public HEADI(Simti enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Esempio n. 14
0
        /// <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>();
        }