RuleORama Dynamic Grammar Swift Example

Home Forums OpenEars plugins RuleORama Dynamic Grammar Swift Example

Viewing 4 posts - 1 through 4 (of 4 total)

  • Author
  • #1030603

    I’ve successfully got a word array ruleset working but am having issues getting a dynamic dictionary of phrases working using Swift.

    Is there a sample solution anyone has developed that illustrates how this could be done with Swift?


    I tried converting the dynamic grammar dictionary from the sample app to swift as follow but I get a duplicate key on the second “OneOfTheseWillBeSaidOnce” after “ThisWillBeSaidWithOptionalRepetitions”.

    public func Generate() -> NSDictionary {

    let grammar: NSDictionary = [
    “ThisWillBeSaidOnce”: [“HELLO COMPUTER”, “GREETINGS ROBOT”],
    “OneOfTheseWillBeSaidOnce”: [“DO THE FOLLOWING”, “INSTRUCTION”],
    “OneOfTheseWillBeSaidOnce”: [“GO”, “MOVE”],
    “ThisWIllBeSaidWithOptionalRepetitions”: [
    “OneOfTheseWillBeSaidOnce”: [“LEFT”,”RIGHT”,”FORWARD”],
    “OneOfTheseWillBeSaidOnce”: [“10″,”20″,”30”]
    “OneOfTheseWillBeSaidOnce”: [“EXECUTE”, “DO IT”],
    “ThisCanBeSaidOnce”: [“THANK YOU”]

    return grammar


    Halle Winkler


    Take a closer look at the example in the docs – it isn’t a single dictionary full of repeating keys (this would not be a dictionary, which must have unique keys), it is a dictionary with one key for an array containing several small individual dictionaries.

    Halle Winkler

    There is now a Swift 3 tutorial for RuleORama:

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.