Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    jiawei
    @jchiu2547
    on calendar
    like "schedule chat for 30 mins on ..."
    Brandon Horst
    @brandonhorst
    Within Lacona, or as a separate tool?
    jiawei
    @jchiu2547
    probably separate tool
    Brandon Horst
    @brandonhorst
    OK good, because Lacona already supports that functionality
    Look into the ScheduleEvent phrase here: https://github.com/laconalabs/lacona-events/blob/master/src/extensions.jsx for help with the grammar
    jiawei
    @jchiu2547
    wow...
    job easier now
    Brandon Horst
    @brandonhorst
    :thumbsup:
    jiawei
    @jchiu2547
    somehow limit={1} doesn't seem to work..
    Brandon Horst
    @brandonhorst
    could you show your code?
    jiawei
    @jchiu2547
    <sequence>
    <String limit={1} splitOn={' '} id='name' argument='meeting name' />

    <literal text=' for ' />

    <choice>
    <literal text='30 mins' />
    <literal text='1 hour' />
    </choice>

    <literal text=' on ' />

    <Date id='date' />

    </sequence>
    i also tried splitOn=' '
    Brandon Horst
    @brandonhorst
    what are you seeing that suggests it does not work?
    jiawei
    @jchiu2547
    let me find the output..
    query is "meeting for 1 hour on Wednesday something"
    it has 4 matches when i wanted zero matches
    Brandon Horst
    @brandonhorst
    oh I see what you mean
    unfortunately that isn't really possible
    jiawei
    @jchiu2547
    "words": [
    {
    "text": "meeting for 1 hour on Wednesday something",
    "input": true,
    "argument": "meeting name"
    },
    {
    "text": " for ",
    "input": false
    },
    {
    "text": "1 hour",
    "input": false
    },
    {
    "text": " on ",
    "input": false
    },
    {
    "text": "date",
    "input": false,
    "placeholder": true,
    "argument": "date"
    }
    ],
    here is one of the inputs
    meeting name is matched to "meeting for 1 hour on Wednesday something"
    Brandon Horst
    @brandonhorst
    There is no way for the String to know that "meeting for 1 hour on Wednesday something" is not a valid input
    jiawei
    @jchiu2547
    but i thought limit is supposed to tell it that it should have only one term?
    Brandon Horst
    @brandonhorst
    OOH I see the confusion
    jiawei
    @jchiu2547
    ok it probably means it can have multiple branches
    hmm it means it can match only once instead of multiple times?
    is there a way to add a filter?
    Brandon Horst
    @brandonhorst
    so limit means that it should only have one Branch - which is why, if you entered "meeting for 1 hour on wednesday", it would only suggest "meeting", and not "meeting for 1 hour on wednesday" as well
    however, because "meeting" fails to parse, it keeps trying until it gets to something that DOES parse - "meeting for 1 hour on wednesday whatever"
    You can filter
    So String supports a filter prop, which is just a function that takes a String and returns a Boolean
    <String /> is really just a wrapper for <freetext />, so you can use these docs: https://elliptical.laconalabs.com/doc/apireference/phrases.html#freetext
    jiawei
    @jchiu2547
    Alright, i will try out filter..
    Brandon Horst
    @brandonhorst
    good luck
    jiawei
    @jchiu2547
    Thanks..
    jiawei
    @jchiu2547
    hmm i upgraded to the latest version of elliptical libraries and found myself with errors.....
    SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/jiawei/g/emailapps/node_modules/elliptical-datetime/lib-node/index.js:7:17)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/jiawei/g/emailapps/src/server/commandApps/schedule/utils/getAvailability.js:9:11)
    Brandon Horst
    @brandonhorst
    that's interesting - could you send code that I could reproduce it with?
    jiawei
    @jchiu2547
    Btw, I am from Mixmax.. Brad says Hi!
    Brad Vogel
    @bradvogel
    Hey Brandon! Brad here. We're finally integrating Elliptical into Mixmax. Sorry for the delay. Congrats on the all ProductHunt success - 1600+ upvotes, wow!
    Brandon Horst
    @brandonhorst
    Thanks!
    Adam Pietrasiak
    @pietrasiak
    hey guys! first of all - that so amazing framework
    I have few questions that would help me understand it a bit better, as I wanted to understand it a bit before I use/contribute it
    1 why do you use generator functions all around there?
    2 would it be possible for you to add some brief comments in code (mostly compile.js, match.js and some of more tricky phrases
    I was trying to undestand what is happening under the hood durign compilation and parsing. Maybe could you describe basic idea of how things are working / how to start modifying the code. Also, did you consider porting it to something like flow or typescript?
    Brandon Horst
    @brandonhorst

    Of course!

    So generator functions are used because the allow us to see the outcome of a given parse path before choosing to pursue other paths. This is used for limiting. Take this sample grammar:

    <sequence>
      <list items={['super', 'superhero']} limit={1} />
      <literal text=' movies' />
    </sequence>

    This grammar would match both super movies and superhero movies. But the limit={1} means that only one valid item from the <list /> should be suggested to the user. So if the user enters su, Elliptical should only return super movies. It would be easy for the implementation of list to just find the first item that matches the input and be done, which would work in the su example and save us from processing every list item.

    However, the problem occurs if the user enters, for example, superhero mov. The first item, super does match with the beginning of superhero movies, but the remaining string (hero mov) does not match with the next item in the sequence (movies). If the list only "tried" the first item, then Elliptical would return nothing, even though superhero mov is a perfectly valid input.

    However, through the magic of Generators yield, we make the list component say "try parsing the rest of the input with super. If it works, great, we're done. If it doesn't work, we'll try with superhero."

    Does that make sense?

    2) Elliptical is fairly stable at this point, and it's definitely overdue for some basic refactoring and some solid comments. I will try to get to that in the near future. I'll see what I can do
    I have considered using TS/Flow, and I think it would be helpful. I think that my next goal is to move the underlying implementation to use Immutable.js, as I think that would give some considerable performance improvements (what with all the _.assign({}, ...) littered throughout the code). That would help with typing, and using TS/Flow would help even more.