Пример #1
0
void HalfDictionary::read( std::istream& is )
{
  clear();

  while (!is.eof())
  {
    WordList ph;
    Hunglish::read(ph,is);

    if (ph.empty())
      continue;

    push_back(ph);
  }
}
Пример #2
0
void DictionaryItems::read( std::istream& is )
{
  clear();

//x   std::ofstream logs("vonyokornai.nojoker.reconstructed.txt");
//x   std::ostream& os = logs;

  while (!is.eof())
  {
    WordList hu;
    WordList en;
    Word delimiter;

    bool engPart = true;

    while (true)
    {
      Word w;
      is >> w;

      if (w.empty())
        break;

      // We allow vonyo7's "@" delimiter, and vonyokornai's "@V", "@N" etc. delimiters.
      if ( (w.size()<=2) && (w[0]=='@') )
      {
        engPart = false;
        delimiter = w;
      }
      else if (engPart)
      {
        en.push_back(w);
      }
      else
      {
        hu.push_back(w);
      }

      while ( (is.peek()==' ') || (is.peek()=='\r') )
      {
        is.ignore();
      }
      
      if (is.peek()=='\n')
      {
        is.ignore();
        break;
      }
    }

    if (en.empty())
      break;

    push_back(std::make_pair(en,hu));

//x     WordList::const_iterator it;
//x     for ( it=en.begin(); it!=en.end(); ++it )
//x     {
//x       os << *it << " ";
//x     }
//x     os << delimiter ;
//x     for ( it=hu.begin(); it!=hu.end(); ++it )
//x     {
//x       os << " " << *it ;
//x     }
//x     os << "\n";
  }

//x   os.flush();
}