Coder Social home page Coder Social logo

Comments (2)

joestelmach avatar joestelmach commented on July 18, 2024

Thanks for your feedback Oz.

I agree that things like 'the next 5 weeks', and 'last 2 years' should be represented as ranges, but I'm not so sure about 'next week' being represented that way. Usually when I say 'next week' it's in the context of a single day, not a range: 'Let's have lunch next week'.

Anyway, I changed the representation of 'next 5 weeks', 'next 2 years', etc to be ranges, and I was also able to add in support for 'last 2 weeks', 'last 5 years', etc: 40a0521

I'm not sure I understand your last request. Can you elaborate, or provide a sample of the natty method calls you'd like to see?

You can try out these new features by referencing the 0.4-SNAPSHOT version from the following maven repository:

<repository>
  <id>sonatype_snapshots</id>
  <name>Sonatype Snapshots</name>
  <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>

from natty.

oztune avatar oztune commented on July 18, 2024

Hey Joe,

Thanks for the really quick feedback! It's pretty awesome how few lines of code those changes took.

About last week, next month, etc.: My current use for natty is to allow the user to quickly choose date ranges. In that context typing in 'last week' would imply wanting to choose the date range from sunday of last week to the following saturday. The results I'd expect in this case are pretty much in-line with what wolfram|alpha and chronic return for those queries as well.

But your example is obviously also valid. So since the type of output seems to be specific to each use/application, I think the ideal solution would be to let the user of the framework specify if they'd prefer single dates or ranges as output when both are a valid response. Chronic does a similar thing where if you set the 'guess' option to false it'll stop trying to guess a specific day and just pass back the entire range.

Along that same train of thought, it'd also be great to specify other 'hints' to the parser.
For example, in chronic you can specify the context of the request (past, future, or none) and it uses it in cases where the input is vague. For example, if I were to pass in 'May' which May should Natty pass back? (I see that 'May' isn't a valid input currently, but I don't see a reason why it couldn't be). Since my application always deals with data from the past it would make sense for it to automatically default to May 2011, but that won't be the case for everyone. The same hints could also be applied to vague input like 'Sep 2', 'Dec 31', etc.

About the last request:
Users of my system can create a list of important events that have occurred in the past. Each event has a name and either a single date or a date range. So I'd like my date range picker to be extra smart and recognize their events.
So for example, let's say that a user defined their birthday as Oct 24. Then they go to the date range picker and type in something like 'my birthday two years ago', my system would take that string and convert it to '(OCTOBER 24) two years ago' and pass that to Natty. It'd be sweet if natty could then spit back the correct response. Essentially I guess what I'm asking for is the ability to pass natty pre-calculated dates mixed in with the natural language that it could just take into account without having to think too much.

I just have to say that overall I'm quite impressed with Natty so far. I'd really like to use it in my current project and later ones as well. There are a few other smaller things that I've seen in other frameworks which if added to Natty I think would really put it over the top. Is is cool if I keep pestering you with more of these requests? :)

from natty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.