Code Monkey home page Code Monkey logo

nickel's People

Contributors

ansont avatar iainbeeston avatar kevineder avatar lzell avatar modsognir avatar paulbjensen avatar retro avatar tigerwolf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nickel's Issues

April 29, 5-8PM

Hello,

The following date is not parsed correctly "April 29 5-8PM"

I'm having trouble finding where in the code this can be remedied. Would appreciate a patch or any tips.

Here's a test case if that helps:

def test__april_29_5_to_8_pm
    now = Time.local(2008, 11, 30)
    assert_nlp NLP.new("April 29, 5-8pm", now), 
      [Occurrence.new(
        :type => :single, 
        :start_date => ZDate.new("20080429"), 
        :start_time => ZTime.new("5", :pm),
        :end_time => ZTime.new("8", :pm))]

  end

regex warnings

I'm still seeing regex warnings like "warning: nested repeat operator + and ? was replaced with '*'" though i see there was a commit a year ago to fix some. has the gem not been updated?

Default to Today if no date is specified

Email from Mike S:

If you do not specify a day then I expected it to default to "today" but it appears to just swallow the time and return only the message.

For instance, the query "Do some stuff at 1300" returns:

<?xml version="1.0" encoding="UTF-8"?>
<naturalinputsResponse>
  <message>Do some stuff</message>
</naturalinputsResponse>

But I expected something like this:

<?xml version="1.0" encoding="UTF-8"?>
<naturalinputsResponse>
  <message>Do some stuff</message>
  <occurrence>
    <type>single</type>
    <start_date>20110321</start_date>
    <start_time>13:00:00</start_time>
  </occurrence>
</naturalinputsResponse>

Lunch every monday at 12pm until January 4th

Email from Joel B:
Lunch every Monday at 12pm until January 4th

  • start date is next Monday, but the end date is last January?

Note: both of these work (the second one gets me the extra lunch date I wanted on 1/2/2012):

  • Lunch every Monday at 12pm until January
  • Lunch every Monday at 12pm until January 4th, 2012

Warnings in 1.9.2-p180

This is with nickel version 0.0.5.

ruby-1.9.2-p180 :001 > require 'nickel'
~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: warning: nested repeat      operator + and ? was replaced with '*': /\bany(?:\s+)?day\b/
~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: warning: nested repeat operator + and ? was replaced with '*': /([0-9])(?:\s+)?a\b/
~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: warning: nested repeat operator + and ? was replaced with '*': /([0-9])(?:\s+)?p\b/
~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: warning: nested repeat operator + and ? was replaced with '*': /this(?:\s+)?morning/
~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: warning: nested repeat operator + and ? was replaced with '*': /^(?:\s+)?(?:right\s+)?now(?:\s+)?$/
~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: warning: nested repeat     operator + and ? was replaced with '*': /^(?:\s+)?(?:right\s+)?now(?:\s+)?$/
~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: warning: nested repeat operator + and ? was replaced with '*'
 => true 

Nice work on this gem, it handles everything I've thrown at it well. If I have time I'll submit a pull request.

Wrong date extractions

Example 1:

@sciencemagazine is stuck in the 19th century, when it made sense to reject 95% of submissions" - @plos cofounder @mbeisen cc #wcsj2013 wrongly extracts to 19th of July 2013

SUTime is correct:

the 19th century    19XX    <TIMEX3 tid="t1" value="19XX" type="DATE">the 19th century</TIMEX3>
2013    2013    <TIMEX3 tid="t2" value="2013" type="DATE">2013</TIMEX3>

Example 2:
Withings commercially launches Pulse, its first activity tracker http://t.co/bbKAf37veT wrongly extracts to 1st of July 2013

SUTime is correct:
No temporal expressions.

Example 3:
excellent RT @nickbarnes: Gave 1st talk at SoundSoftware 2013: "10 Reasons you must publish your code". Pulled no punches. #openscience wrongly extracts to 1st of July 2013

SUTime is correct:
2013 2013 <TIMEX3 tid="t1" value="2013" type="DATE">2013</TIMEX3>

Example 4:
Been listening to the Vampires of the Modern City album for the past few weeks, and it's absolutely fantastic. #vampireweekend wrongly extracts to 30th of June 2013

SUTime is correct:
the past few weeks PXW <TIMEX3 tid="t1" value="PXW" type="DURATION">the past few weeks</TIMEX3>

I'll soon be in a position to provide a database of these wrong classifications, would that be helpful?

Ending dates

I notice that the following string parses as a start date instead of ending date: "Ending on 12/15/2014"

require "rubygems"
require "nickel.rb"

Parse the string

string = "Ending on 12/15/2014"
results = Nickel.parse(string, Time.now)
puts results.inspect

Results in: message: "", occurrences: [#<Occurrence type: single, start_date: 20141215>]

Apostrophe's don't work in event names

If you have an apostrophe in your event, it gets stripped out and makes the word it was attached to lower case. For example, I entered:

2/10 1pm Archie's Birthday Party

and the title of the event turned into:

archies Birthday Party

having a dash "-" in the input with no date returns a daily occurrence beginning w/ the current day

Example:

Nickel.parse "job search - apply at virgin intergalactic"

Returns:

message: "job search apply at virgin intergalactic", occurrences: [#<Occurrence type: daily, start_date: "20110428", interval: 1>] 

I would expect without any date information, it should return an empty array for occurrences.

Additionally, Nickel.parse "-" by itself results in NoMethodError: undefined method `interpret_date' for nil:NilClass

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.