예제 #1
0
 /// <summary>
 /// Initialize a new instance of StandardTokenizer.
 /// </summary>
 /// <param name="file">The dawg format file.</param>
 public StandardTokenizer(string file)
 {
     using (var stream = Utils.LoadDawgFile(file))
     {
         var decoder = new DawgDecoder(Dawg.FILEVERSION);
         _dawg = decoder.Decode(stream);
     }
 }
예제 #2
0
 /// <summary>
 /// Initialize a new instance of StandardTokenizer.
 /// </summary>
 /// <param name="file">The dawg format file.</param>
 public StandardTokenizer(string file)
 {
     using (var stream = Utils.LoadDawgFile(file))
     {
         var decoder = new DawgDecoder(Dawg.FILEVERSION);
         _dawg = decoder.Decode(stream);
     }
 }
예제 #3
0
 /// <summary>
 /// Initialize a new instance of StandardTokenizer.
 /// </summary>
 /// <param name="file">The dawg format file.</param>
 public StandardTokenizer(string file)
 {
     if (!File.Exists(file))
     {
         throw new FileNotFoundException("The file of dawg does not exist.", file);
     }
     using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read))
     {
         var decoder = new DawgDecoder(Dawg.FILEVERSION);
         _dawg = decoder.Decode(fs);
     }
 }
예제 #4
0
        public static WordDict LoadFrom(Stream input)
        {
            var decoder  = new DawgDecoder(Dawg.FILEVERSION);
            var dawg     = decoder.Decode(input);
            var wordUtil = new WordDict();

            foreach (var pair in dawg.MatchsPrefix(null))
            {
                wordUtil.AddInternal(pair.Key, pair.Value);
            }

            return(wordUtil);
        }
예제 #5
0
파일: WordUtil.cs 프로젝트: ikvm/CWSharp
        public static WordUtil LoadFrom(Stream input)
        {
            var decoder = new DawgDecoder(Dawg.FILEVERSION);
            var dawg = decoder.Decode(input);
            var wordUtil = new WordUtil();

            foreach (var pair in dawg.MatchsPrefix(null))
            {
                wordUtil.AddInternal(pair.Key, pair.Value);
            }

            return wordUtil;
        }
예제 #6
0
        /// <summary>
        /// Initialize a new instance of StandardTokenizer.
        /// </summary>
        /// <param name="src">The stream of the dawg file.</param>
        public StandardTokenizer(Stream src)
        {
            var decoder = new DawgDecoder(Dawg.FILEVERSION);

            _dawg = decoder.Decode(src);
        }