bigram.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2009 Openmoko Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef BIGRAM_H
  18. #define BIGRAM_H
  19. #define SUPPORTED_SEARCH_CHARS " !#$%&'()*+,-.0123456789abcdefghijklmnopqrstuvwxyz=?@"
  20. // SERCH_CHR_COUNT needs to be strlen(SUPPORTED_SEARCH_CHARS) + 1
  21. #define SEARCH_CHR_COUNT 54
  22. #define SIZE_BIGRAM_BUF (128 * 2)
  23. int bigram_char_idx(char c);
  24. void bigram_encode(char *outStr, char *inStr);
  25. void bigram_decode(char *outStr, char *inStr, int lenMax);
  26. #ifdef WIKIPCF
  27. void init_bigram(FILE *fd);
  28. #else
  29. void init_bigram(int fd);
  30. #endif
  31. void init_char_idx();
  32. int is_supported_search_char(char c);
  33. int search_string_cmp(char *title, char *search, int len);
  34. #endif