base_rule_store.d.ts 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { AuditoryDescription } from '../audio/auditory_description.js';
  2. import { AxisOrder, DynamicCstr, DynamicCstrParser } from './dynamic_cstr.js';
  3. import { Action, Precondition, SpeechRule } from './speech_rule.js';
  4. import { SpeechRuleContext } from './speech_rule_context.js';
  5. import { SpeechRuleEvaluator } from './speech_rule_evaluator.js';
  6. import { SpeechRuleFunction } from './speech_rule_functions.js';
  7. import { SpeechRuleStore } from './speech_rule_store.js';
  8. export declare abstract class BaseRuleStore implements SpeechRuleEvaluator, SpeechRuleStore {
  9. context: SpeechRuleContext;
  10. parseOrder: AxisOrder;
  11. parser: DynamicCstrParser;
  12. locale: string;
  13. modality: string;
  14. domain: string;
  15. parseMethods: any;
  16. initialized: boolean;
  17. inherits: BaseRuleStore;
  18. kind: string;
  19. customTranscriptions: {
  20. [key: string]: string;
  21. };
  22. protected preconditions: Map<string, Condition>;
  23. private speechRules_;
  24. private rank;
  25. private static compareStaticConstraints_;
  26. private static comparePreconditions_;
  27. constructor();
  28. defineRule(name: string, dynamic: string, action: string, prec: string, ...args: string[]): SpeechRule;
  29. addRule(rule: SpeechRule): void;
  30. deleteRule(rule: SpeechRule): void;
  31. findRule(pred: (rule: SpeechRule) => boolean): SpeechRule;
  32. findAllRules(pred: (rule: SpeechRule) => boolean): SpeechRule[];
  33. evaluateDefault(node: Node): AuditoryDescription[];
  34. evaluateWhitespace(_str: string): AuditoryDescription[];
  35. evaluateCustom(str: string): AuditoryDescription;
  36. evaluateCharacter(str: string): AuditoryDescription;
  37. abstract evaluateString(str: string): AuditoryDescription[];
  38. abstract initialize(): void;
  39. removeDuplicates(rule: SpeechRule): void;
  40. getSpeechRules(): SpeechRule[];
  41. setSpeechRules(rules: SpeechRule[]): void;
  42. getPreconditions(): Map<string, Condition>;
  43. parseCstr(cstr: string): DynamicCstr;
  44. parsePrecondition(query: string, rest: string[]): Precondition;
  45. parseAction(action: string): Action;
  46. parse(ruleSet: RulesJson): void;
  47. parseRules(rules: string[][]): void;
  48. generateRules(generator: string): void;
  49. defineAction(name: string, action: string): void;
  50. getFullPreconditions(name: string): Condition;
  51. definePrecondition(name: string, dynamic: string, prec: string, ...args: string[]): void;
  52. inheritRules(): void;
  53. ignoreRules(name: string, ...cstrs: string[]): void;
  54. private parsePrecondition_;
  55. }
  56. declare class Condition {
  57. private base;
  58. private _conditions;
  59. private constraints;
  60. private allCstr;
  61. constructor(base: DynamicCstr, condition: Precondition);
  62. get conditions(): [DynamicCstr, Precondition][];
  63. addConstraint(dynamic: DynamicCstr): void;
  64. addBaseCondition(cond: Precondition): void;
  65. addFullCondition(cond: Precondition): void;
  66. private addCondition;
  67. }
  68. export interface RulesJson {
  69. modality?: string;
  70. domain?: string;
  71. locale?: string;
  72. kind?: string;
  73. inherits?: string;
  74. functions?: {
  75. [key: string]: SpeechRuleFunction;
  76. };
  77. rules?: any[];
  78. annotators?: any[];
  79. }
  80. export {};