コード例 #1
0
        //Load unknown recognition dictionary
        //Load context
        //type: Unknown words type (including person,place,transliterion and so on)
        public bool Configure(string sConfigFile, TAG_TYPE type)
        {
            //Load the unknown recognition dictionary
            m_dict.Load(sConfigFile + ".dct");

            //Load the unknown recognition context
            m_roleTag.LoadContext(sConfigFile + ".ctx");

            //Set the tagging type
            m_roleTag.SetTagType(type);
            switch (type)
            {
            case TAG_TYPE.TT_PERSON:
            case TAG_TYPE.TT_TRANS_PERSON:
                //Set the special flag for transliterations
                m_nPOS          = -28274; //-'n'*256-'r';
                m_sUnknownFlags = "未##人";
                break;

            case TAG_TYPE.TT_PLACE:
                m_nPOS          = -28275; //-'n'*256-'s';
                m_sUnknownFlags = "未##地";
                break;

            default:
                m_nPOS = 0;
                break;
            }
            return(true);
        }
コード例 #2
0
    private void log(int level, string value, TAG_TYPE tagType)
    {
        if (DebugMode == false)
        {
            return;
        }

        if (tagType == TAG_TYPE.OPEN)
        {
            //Console.WriteLine(printTab(level) + "-> " + value);
        }
        else if (tagType == TAG_TYPE.CLOSE)
        {
            //Console.WriteLine(printTab(level) + "<- " + value);
        }
        else
        {
            //Console.WriteLine(printTab(level) + "<> " + value);
        }
    }
コード例 #3
0
        public Span()
        {
            if (m_tagType != TAG_TYPE.TT_NORMAL)
            {
                m_nTags[0, 0] = 100;
            }
            //Begin tag
            else
            {
                m_nTags[0, 0] = 0;
            }
            //Begin tag

            m_nTags[0, 1]        = -1;
            m_dFrequency[0, 0]   = 0;
            m_nCurLength         = 1;
            m_nUnknownWordsCount = 0;
            m_nStartPos          = 0;
            m_nWordPosition[1]   = 0;
            m_sWords[0]          = null;

            m_tagType = TAG_TYPE.TT_NORMAL; //Default tagging type
        }
コード例 #4
0
      //Load unknown recognition dictionary
      //Load context
      //type: Unknown words type (including person,place,transliterion and so on)
      public bool Configure(string sConfigFile, TAG_TYPE type)
      {
         //Load the unknown recognition dictionary
         m_dict.Load(sConfigFile + ".dct");

         //Load the unknown recognition context
         m_roleTag.LoadContext(sConfigFile + ".ctx");

         //Set the tagging type
         m_roleTag.SetTagType(type);
         switch (type)
         {
            case TAG_TYPE.TT_PERSON:
            case TAG_TYPE.TT_TRANS_PERSON:
               //Set the special flag for transliterations
               m_nPOS = -28274; //-'n'*256-'r';
               m_sUnknownFlags = "未##人";
               break;
            case TAG_TYPE.TT_PLACE:
               m_nPOS = -28275; //-'n'*256-'s';
               m_sUnknownFlags = "未##地";
               break;
            default:
               m_nPOS = 0;
               break;
         }
         return true;
      }
コード例 #5
0
ファイル: Span.cs プロジェクト: 89sos98/iveely
        public Span()
        {
            if (m_tagType != TAG_TYPE.TT_NORMAL)
                m_nTags[0, 0] = 100;
            //Begin tag
            else
                m_nTags[0, 0] = 0;
            //Begin tag

            m_nTags[0, 1] = -1;
            m_dFrequency[0, 0] = 0;
            m_nCurLength = 1;
            m_nUnknownWordsCount = 0;
            m_nStartPos = 0;
            m_nWordPosition[1] = 0;
            m_sWords[0] = null;

            m_tagType = TAG_TYPE.TT_NORMAL; //Default tagging type
        }
コード例 #6
0
ファイル: Span.cs プロジェクト: 89sos98/iveely
 //Set the tag type
 public void SetTagType(TAG_TYPE nType)
 {
     m_tagType = nType;
 }
コード例 #7
0
        //タグを解析
        bool ParseTag(string text, ref int index, ref Color currentColor, ref int currentSize)
        {
            if (text[index] == '<')
            {
                int           startIndex = index + 1;
                int           length     = 0;
                List <string> args;
                int           size;
                TAG_TYPE      tag = ParaseTag(text, startIndex, out length, out args);
                switch (tag)
                {
                case TAG_TYPE.COLOR_BEGIN:
                    if (ColorUtil.TryParseColor(args[0], ref currentColor))
                    {
                        break;
                    }
                    else
                    {
                        return(false);
                    }

                case TAG_TYPE.COLOR_END:
                    currentColor = defaultColor;
                    break;

                case TAG_TYPE.SIZE_BEGIN:
                    if (int.TryParse(args[0], out size))
                    {
                        currentSize = size;
                        break;
                    }
                    else
                    {
                        return(false);
                    }

                case TAG_TYPE.SIZE_END:
                    currentSize = defaultSize;
                    break;

                case TAG_TYPE.PARAM:
                {
                    string str = ExpressionToString(args[0]);
                    AddStrng(str, currentColor, currentSize);
                    break;
                }

                case TAG_TYPE.FORMAT:
                {
                    int      num      = args.Count - 1;
                    string[] parmKeys = new string[num];
                    args.CopyTo(1, parmKeys, 0, num);
                    string str = FormatExpressionToString(args[0], parmKeys);
                    AddStrng(str, currentColor, currentSize);
                    break;
                }

                default:
                    AddErrorMsg(LanguageErrorMsg.LocalizeTextFormat(Utage.ErrorMsg.TextTagParse, text.Substring(startIndex, length)));
                    return(false);
                }
                ;
                index += (length + 1);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #8
0
 //Set the tag type
 public void SetTagType(TAG_TYPE nType)
 {
     m_tagType = nType;
 }