UnigramCorpusReader.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: GPL 2.0
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License. You should have
  7. * received a copy of the GPL license along with this program; if you
  8. * did not, you can find it at http://www.gnu.org/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is Coreseek.com code.
  16. *
  17. * Copyright (C) 2007-2008. All Rights Reserved.
  18. *
  19. * Author:
  20. * Li monan <li.monan@gmail.com>
  21. *
  22. * ***** END LICENSE BLOCK ***** */
  23. #ifndef css_UnigramCorpusReader_h
  24. #define css_UnigramCorpusReader_h
  25. #include <string>
  26. #include <vector>
  27. #include "ICorpusReader.h"
  28. #include "UnigramRecord.h"
  29. namespace css {
  30. class UnigramCorpusReader : virtual public ICorpusReader {
  31. public:
  32. virtual UnigramRecord* getAt(int idx);
  33. UnigramCorpusReader();
  34. virtual int open(const char* filename, const char* type);
  35. virtual long count();
  36. protected:
  37. std::string m_filename;
  38. protected:
  39. /**
  40. * all parsed unigram-record here
  41. * @element-type UnigramRecord
  42. */
  43. std::vector<UnigramRecord> m_items;
  44. };
  45. } /* End of namespace css */
  46. #endif