Beispiel #1
0
 /// <exclude/>
 /// <summary>
 /// Construct a DictionarBasedBreakIterator from precompiled rules.
 /// </summary>
 ///
 /// <param name="compiledRules">an input stream containing the binary (flattened) compiledrules.</param>
 /// <param name="dictionaryStream">an input stream containing the dictionary data</param>
 public DictionaryBasedBreakIterator(Stream compiledRules,
                                     Stream dictionaryStream)
 {
     fRData = IBM.ICU.Text.RBBIDataWrapper.Get(compiledRules);     // Init the RBBI part of
     // this iterator.
     dictionary = new BreakDictionary(dictionaryStream);
 }
        // =================================================================================
        // testing and debugging
        // =================================================================================
        /// <exclude/>
        public static void Main(String[] args)
        {
            String filename = args[0];

            BreakDictionary dictionary = new BreakDictionary(File.OpenRead(filename));

            StreamWriter xout = null;

            if (args.Length >= 2)
            {
                //xout = ILOG.J2CsMapping.IO.IOUtility.NewStreamWriter(ILOG.J2CsMapping.IO.IOUtility.NewStreamWriter(File.OpenWrite(args[1]),System.Text.Encoding.GetEncoding("UnicodeLittle"))) /* Warning: if writer (arg) is a StringWriter exception raised */;
            }

            dictionary.PrintWordList("", 0, xout);

            if (xout != null)
            {
                xout.Close();
            }
        }
Beispiel #3
0
        /**
         * Special variable name for characters in words in dictionary
         */

        /// <summary>
        /// Constructs a DictionaryBasedBreakIterator.
        /// </summary>
        ///
        /// <param name="rules">Same as the rules parameter on RuleBasedBreakIterator, exceptfor the special meaning of "_dictionary_". This parameter isjust passed through to RuleBasedBreakIterator constructor.</param>
        /// <param name="dictionaryStream">the stream containing the dictionary data</param>
        /// @stable ICU 2.0
        public DictionaryBasedBreakIterator(String rules,
                                            Stream dictionaryStream) : base(rules)
        {
            dictionary = new BreakDictionary(dictionaryStream);
        }