Пример #1
0
 /*
  * public void save(String filename) {
  * try {
  * DataOutputStream rf = IOUtils.getDataOutputStream(filename);
  * save(rf);
  * rf.close();
  * } catch (Exception e) {
  * e.printStackTrace();
  * }
  * }
  */
 internal virtual void Save(DataOutputStream file)
 {
     string[] arr = Sharpen.Collections.ToArray(dict.Keys, new string[dict.Keys.Count]);
     try
     {
         file.WriteInt(arr.Length);
         log.Info("Saving dictionary of " + arr.Length + " words ...");
         foreach (string word in arr)
         {
             TagCount count = Get(word);
             file.WriteUTF(word);
             count.Save(file);
         }
         int[] arrverbs = Sharpen.Collections.ToArray(this.partTakingVerbs.Keys, new int[partTakingVerbs.Keys.Count]);
         file.WriteInt(arrverbs.Length);
         foreach (int iO in arrverbs)
         {
             CountWrapper tC = this.partTakingVerbs[iO];
             file.WriteInt(iO);
             tC.Save(file);
         }
     }
     catch (Exception e)
     {
         Sharpen.Runtime.PrintStackTrace(e);
     }
 }
Пример #2
0
 protected internal virtual void Read(DataInputStream file)
 {
     try
     {
         ReadTags(file);
         int len1 = file.ReadInt();
         for (int i = 0; i < len1; i++)
         {
             int          iO = file.ReadInt();
             CountWrapper tC = new CountWrapper();
             tC.Read(file);
             this.partTakingVerbs[iO] = tC;
         }
     }
     catch (IOException e)
     {
         Sharpen.Runtime.PrintStackTrace(e);
     }
 }
Пример #3
0
 protected internal virtual void Read(string filename)
 {
     try
     {
         DataInputStream rf = IOUtils.GetDataInputStream(filename);
         Read(rf, filename);
         int len1 = rf.ReadInt();
         for (int i = 0; i < len1; i++)
         {
             int          iO = rf.ReadInt();
             CountWrapper tC = new CountWrapper();
             tC.Read(rf);
             this.partTakingVerbs[iO] = tC;
         }
         rf.Close();
     }
     catch (IOException e)
     {
         Sharpen.Runtime.PrintStackTrace(e);
     }
 }