text breaker with icu4c
Inheritance: TextBreaker
Example #1
0
        public static void Test1()
        {
            int major, minor, revision;

            NativeTextBreakerLib.MyFtLibGetFullVersion(out major, out minor, out revision);
            NativeTextBreaker.SetICUDataFile(@"d:\WImageTest\icudt57l\icudt57l.dat");

            string            str         = "ABCD EFGH IJKL\0";
            var               textBreaker = new NativeTextBreaker(TextBreakKind.Word, "en-US");
            List <SplitBound> tokens      = new List <SplitBound>();

            textBreaker.DoBreak(str, splitBound =>
            {
                tokens.Add(splitBound);
            });
        }
Example #2
0
        private void cmdIcuTest_Click(object sender, EventArgs e)
        {

            if (nativeTextBreak == null)
            {
                nativeTextBreak = new NativeTextBreaker(LayoutFarm.TextBreak.ICU.TextBreakKind.Word, currentLocale);
            }

            char[] textBuffer = this.textBox1.Text.ToCharArray();
            this.listBox1.Items.Clear();
            nativeTextBreak.DoBreak(textBuffer, 0, textBuffer.Length, bounds =>
            {
                //sub string               
                string s = new string(textBuffer, bounds.startIndex, bounds.length);
                this.listBox1.Items.Add(bounds.startIndex + " " + s);

            });

        }
Example #3
0
        void ParseWithIcu(int ntimes)
        {

            //-------------------
            if (nativeTextBreak == null)
            {
                nativeTextBreak = new NativeTextBreaker(LayoutFarm.TextBreak.ICU.TextBreakKind.Word, currentLocale);
            }

            char[] textBuffer = this.textBox1.Text.ToCharArray();
            for (int i = ntimes - 1; i >= 0; --i)
            {
                nativeTextBreak.DoBreak(textBuffer, 0, textBuffer.Length, bounds =>
                {
                    //sub string            
                });
            }
        }
 public MyNativeTextBreaker()
 {
     myTextBreaker = new NativeTextBreaker(LayoutFarm.TextBreak.ICU.TextBreakKind.Word, "en-US");
 }
        public static void Test1()
        {


            int major, minor, revision;
            NativeTextBreakerLib.MyFtLibGetFullVersion(out major, out minor, out revision);
            NativeTextBreaker.SetICUDataFile(@"d:\WImageTest\icudt57l\icudt57l.dat");

            string str = "ABCD EFGH IJKL\0";
            var textBreaker = new NativeTextBreaker(TextBreakKind.Word, "en-US");
            List<SplitBound> tokens = new List<SplitBound>();
            textBreaker.DoBreak(str, splitBound =>
            {
                tokens.Add(splitBound);
            });

        }