GRAMMAR.js 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * GRAMMAR
  3. *
  4. * Precomputed permutations of various grammar/formatting opts provided as
  5. * constants for convenient use with `rttc.getNounPhrase()` and/or `getDisplayType()`.
  6. * ```
  7. * role / capitalization
  8. * FRAGMENT ({capitalization: 'fragment'})
  9. * SENTENCE ({completeSentence: true} or {capitalization: 'start'} -- depending on where it's used)
  10. * TITLE ({capitalization: 'title'})
  11. * plural
  12. * SINGULAR ({plural: false})
  13. * PLURAL ({plural: true})
  14. * determiner
  15. * DEFINITE ({determiner: 'the'})
  16. * INDEFINITE ({determiner: 'a'})
  17. * EXISTENTIAL ({determiner: 'any'})
  18. * UNPRECEDED ({determiner: ''})
  19. * ```
  20. *
  21. * > Note that this doesn't necessarily include EVERY possible mashup- just the
  22. * > common ones. (It deliberately excludes some defaults to avoid redundancy.)
  23. * >
  24. * > Also be aware that **NOT EVERY COMBINATION HEREIN IS SUPPORTED** for ALL methods.
  25. * > Some combos might only be supported for either `.getDisplayTypeLabel()`, while others
  26. * > only work for `.getNounPhrase()`. Be sure to do a few examples as thought experiments
  27. * > any time you pick a grammatical option set, since bad combos fail silently! (No error!)
  28. *
  29. * @type {Dictionary}
  30. */
  31. module.exports = {
  32. // Basics:
  33. // =============================================
  34. DEFINITE: {determiner:'the'},
  35. INDEFINITE: {determiner:'a'},
  36. EXISTENTIAL: {determiner:'any'},
  37. UNPRECEDED: {determiner:''},
  38. SINGULAR: {plural: false},
  39. PLURAL: {plural: true},
  40. FRAGMENT: {capitalization: 'fragment'},
  41. SENTENCE: {capitalization: 'start', completeSentence: true},
  42. TITLE: {capitalization: 'title'},
  43. // 2D Mashups:
  44. // =============================================
  45. DEFINITE_PLURAL: {determiner:'the', plural: true},
  46. // *Can't do indefinite plural ("an aardvarks")* (because we don't have the right aggregator word to build e.g. "a troupe of aardvarks")
  47. EXISTENTIAL_PLURAL: {determiner:'any', plural: true},
  48. UNPRECEDED_PLURAL: {determiner:'', plural: true},
  49. PLURAL_FRAGMENT: {plural: true, capitalization: 'fragment'},
  50. PLURAL_SENTENCE: {plural: true, capitalization: 'start', completeSentence: true},
  51. PLURAL_TITLE: {plural: true, capitalization: 'title'},
  52. DEFINITE_FRAGMENT: {determiner: 'the', capitalization: 'fragment'},
  53. INDEFINITE_FRAGMENT: {determiner: 'a', capitalization: 'fragment'},
  54. EXISTENTIAL_FRAGMENT: {determiner: 'any', capitalization: 'fragment'},
  55. UNPRECEDED_FRAGMENT: {determiner: '', capitalization: 'fragment'},
  56. DEFINITE_SENTENCE: {determiner: 'the', capitalization: 'start', completeSentence: true},
  57. INDEFINITE_SENTENCE: {determiner: 'a', capitalization: 'start', completeSentence: true},
  58. EXISTENTIAL_SENTENCE: {determiner: 'any', capitalization: 'start', completeSentence: true},
  59. UNPRECEDED_SENTENCE: {determiner: '', capitalization: 'start', completeSentence: true},
  60. // It never makes sense to use `title` at the same time as the determiner opts,
  61. // since neither of the methods supports both of them!
  62. // ```
  63. // DEFINITE_TITLE: {determiner: 'the', capitalization: 'title'},
  64. // INDEFINITE_TITLE: {determiner: 'a', capitalization: 'title'},
  65. // EXISTENTIAL_TITLE: {determiner: 'any', capitalization: 'title'},
  66. // UNPRECEDED_TITLE: {determiner: '', capitalization: 'title'},
  67. // ```
  68. // 3D Mashups:
  69. // =============================================
  70. DEFINITE_PLURAL_FRAGMENT: {determiner: 'the', plural: true, capitalization: 'fragment'},
  71. // *Can't do indefinite plural (see above)*
  72. EXISTENTIAL_PLURAL_FRAGMENT: {determiner: 'any', plural: true, capitalization: 'fragment'},
  73. UNPRECEDED_PLURAL_FRAGMENT: {determiner: '', plural: true, capitalization: 'fragment'},
  74. DEFINITE_PLURAL_SENTENCE: {determiner: 'the', plural: true, capitalization: 'start', completeSentence: true},
  75. // *Can't do indefinite plural (see above)*
  76. EXISTENTIAL_PLURAL_SENTENCE: {determiner: 'any', plural: true, capitalization: 'start', completeSentence: true},
  77. UNPRECEDED_PLURAL_SENTENCE: {determiner: '', plural: true, capitalization: 'start', completeSentence: true},
  78. // It wouldn't make sense to use `title` at the same time as the determiner opts.
  79. // (See above for explanation.)
  80. // ```
  81. // DEFINITE_PLURAL_TITLE: {determiner: 'the', plural: true, capitalization: 'title'},
  82. // // *Can't do indefinite plural (see above)*
  83. // EXISTENTIAL_PLURAL_TITLE: {determiner: 'any', plural: true, capitalization: 'title'},
  84. // UNPRECEDED_PLURAL_TITLE: {determiner: '', plural: true, capitalization: 'title'},
  85. // ```
  86. };