コード例 #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
ファイル: StandardTokenizer.cs プロジェクト: ikvm/CWSharp
 /// <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
ファイル: WordDict.cs プロジェクト: zhengchun/CWSharp
        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);
        }