예제 #1
0
파일: DictEngine.cs 프로젝트: sheeeng/Zydeo
 /// <summary>
 /// Ctor: initialize from binary dictionary file.
 /// </summary>
 /// <param name="dictFileName">Name of the compiled binary dictionary.</param>
 /// <param name="cvr">Font coverage info provider for lookup filtering.</param>
 public DictEngine(string dictFileName, IFontCoverage cvr)
 {
     this.dictFileName = dictFileName;
     this.cvr = cvr;
     using (BinReader br = new BinReader(dictFileName))
     {
         // Skip release date and entry count
         br.ReadLong();
         br.ReadInt();
         // Skip to position where index starts
         int idxPos = br.ReadInt();
         br.Position = idxPos;
         // Load index
         index = new Index(br);
     }
     // Now, initialize tokenizer with index's word holder
     tokenizer = new Tokenizer(index.WordHolder);
 }
예제 #2
0
 /// <summary>
 /// Ctor: initialize from binary dictionary file.
 /// </summary>
 /// <param name="dictFileName">Name of the compiled binary dictionary.</param>
 /// <param name="cvr">Font coverage info provider for lookup filtering.</param>
 public DictEngine(string dictFileName, IFontCoverage cvr)
 {
     this.dictFileName = dictFileName;
     this.cvr          = cvr;
     using (BinReader br = new BinReader(dictFileName))
     {
         // Skip release date and entry count
         br.ReadLong();
         br.ReadInt();
         // Read position where index starts
         int idxPos = br.ReadInt();
         // Read position where hanzi repo starts
         int hrepoPos = br.ReadInt();
         // Skip to index start; load index
         br.Position = idxPos;
         index       = new Index(br);
         // Skip to hanzi repo start; initi hanzi repo
         br.Position = hrepoPos;
         hrepo       = new HanziRepo(br);
     }
     // Now, initialize tokenizer with index's word holder
     tokenizer = new Tokenizer(index.WordHolder);
 }
예제 #3
0
 /// <summary>
 /// See <see cref="ZD.Common.ICedictEngineFactory.Create"/>.
 /// </summary>
 public ICedictEngine Create(string dictFileName, IFontCoverage cvr)
 {
     return(new DictEngine(dictFileName, cvr));
 }
예제 #4
0
 /// <summary>
 /// See <see cref="ZD.Common.ICedictEngineFactory.Create"/>.
 /// </summary>
 public ICedictEngine Create(string dictFileName, IFontCoverage cvr)
 {
     return new DictEngine(dictFileName, cvr);
 }