Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.8 KiB

  1. /******************************************************************************\
  2. * FILE: unigram.h
  3. *
  4. * Public structures and functions library that are used to access the
  5. * unigram information.
  6. *
  7. * Note that the code to create the binary file is in mkuni, not in the
  8. * common library.
  9. \******************************************************************************/
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /************************************************************************************************\
  14. * Public interface to unigram data.
  15. \************************************************************************************************/
  16. //
  17. // Structures and types
  18. //
  19. // Structure holding basic set of tuning weights.
  20. typedef struct tagTTUNE_COST_SET {
  21. FLOAT UniWeight; // mult weight for unigram cost
  22. FLOAT BaseWeight; // mult weight for baseline
  23. FLOAT HeightWeight; // mult weight for height transition between chars.
  24. FLOAT BoxBaselineWeight; // mult weight for baseline cost given the baseline and
  25. // size of box they were given to write in.
  26. FLOAT BoxHeightWeight; // mult weight for height/size cost given size of box
  27. // they were supposed to write in.
  28. FLOAT CARTAddWeight; // Weight to add to top score when CART updates top choice
  29. } TTUNE_COST_SET;
  30. // This pulls togather all the tuning weights used in the Tsunami Viterbi search. It gives a
  31. // set for each recognizer for each of string and character. It also gives some other misc.
  32. // weights needed.
  33. typedef struct tagTTUNE_COSTS {
  34. FLOAT ZillaGeo; // General zilla vs. otter weight.
  35. FLOAT ZillaStrFudge; // ??? document this!
  36. FLOAT BiWeight; // ??? document this!
  37. FLOAT BiClassWeight; // ??? document this!
  38. TTUNE_COST_SET OtterChar; // Otter character weights
  39. TTUNE_COST_SET OtterString; // Otter string weights
  40. TTUNE_COST_SET ZillaChar; // Zilla character weights
  41. TTUNE_COST_SET ZillaString; // Zilla string weights
  42. } TTUNE_COSTS;
  43. // Structure giving access to a loaded copy of the tsunami tune weights.
  44. typedef struct tagTTUNE_INFO {
  45. TTUNE_COSTS *pTTuneCosts; // Pointer to tune values.
  46. LOAD_INFO info; // Handles for loading and unloading
  47. } TTUNE_INFO;
  48. //
  49. // Functions.
  50. //
  51. // Load unigram information from a file.
  52. extern BOOL TTuneLoadFile(TTUNE_INFO *pTTuneInfo, wchar_t *pPath);
  53. // Unload runtime localization information that was loaded from a file.
  54. extern BOOL TTuneUnloadFile(TTUNE_INFO *pTTuneInfo);
  55. // Load unigram information from a resource.
  56. // Note, don't need to unload resources.
  57. extern BOOL TTuneLoadRes(
  58. TTUNE_INFO *pTTuneInfo,
  59. HINSTANCE hInst,
  60. int nResID,
  61. int nType
  62. );
  63. // Write a properly formated binary file containing the tuning constants.
  64. extern BOOL TTuneWriteFile(TTUNE_INFO *pTTuneInfo, wchar_t *pLocale, FILE *pFile);
  65. #ifdef __cplusplus
  66. };
  67. #endif