Code Monkey home page Code Monkey logo

horai's Introduction

What to do

Derive DateTime from Time expression with Natural language

Sample

jajp = Horai::JaJP.new

time = jajp.parse("1999年")    
=> Fri, 01 Jan 1999 00:00:00 +0900

time = jajp.parse("1月")    
=> Sun, 01 Jan 2012 00:00:00 +0900

time = jajp.parse("1時半")    
=> Thu, 26 Apr 2012 01:30:00 +0900

time = jajp.parse("1分半後")    
=> Thu, 26 Apr 2012 14:11:34 +0900

time = jajp.parse("5時間半と1分半後")    
=> Thu, 26 Apr 2012 19:41:38 +0900

time = jajp.parse("夜の8時に")    
=> Thu, 26 Apr 2012 20:00:00 +0900

time = jajp.parse("午後一時に")    
=> Thu, 26 Apr 2012 13:00:00 +0900

time = jajp.parse("PM1時に")    
=> Thu, 26 Apr 2012 13:00:00 +0900

time = jajp.parse("rpm 6時に")    
=> Thu, 26 Apr 2012 06:00:00 +0900

time = jajp.parse("10日の正午に")    
=> Tue, 10 Apr 2012 12:00:00 +0900

time = jajp.parse("10:20")    
=> Thu, 26 Apr 2012 10:20:00 +0900

time = jajp.parse("10:20:30")    
=> Thu, 26 Apr 2012 10:20:30 +0900

time = jajp.parse("10/20")    
=> Sat, 20 Oct 2012 00:00:00 +0900

time = jajp.parse("2000/10/20")    
=> Fri, 20 Oct 2000 00:00:00 +0900

time = jajp.parse("10/10/20")    
=> Wed, 20 Oct 2010 00:00:00 +0900

time = jajp.parse("2000/10/20 12:30:40")    
=> Fri, 20 Oct 2000 12:30:40 +0900

time = jajp.parse("10年")    
=> Fri, 01 Jan 2010 00:00:00 +0900

time = jajp.parse("30年")    
=> Tue, 01 Jan 2030 00:00:00 +0900

time = jajp.parse("90年")    
=> Mon, 01 Jan 1990 00:00:00 +0900

time = jajp.parse("来年")    
=> Tue, 01 Jan 2013 00:00:00 +0900

time = jajp.parse("来月")    
=> Tue, 01 May 2012 00:00:00 +0900

time = jajp.parse("明日")    
=> Fri, 27 Apr 2012 00:00:00 +0900

time = jajp.parse("明後日")    
=> Sat, 28 Apr 2012 00:00:00 +0900

time = jajp.parse("昨日")    
=> Wed, 25 Apr 2012 00:00:00 +0900

time = jajp.parse("10年後の8月")    
=> Mon, 01 Aug 2022 00:00:00 +0900

time = jajp.parse("10分後")    
=> Thu, 26 Apr 2012 14:20:27 +0900

time = jajp.parse("10日後")    
=> Sun, 06 May 2012 14:10:27 +0900

time = jajp.parse("明日の10時")    
=> Fri, 27 Apr 2012 10:00:00 +0900

time = jajp.parse("明日の10:20:30")    
=> Fri, 27 Apr 2012 10:20:30 +0900

time = jajp.parse("明日の午後5時")    
=> Fri, 27 Apr 2012 17:00:00 +0900

time = jajp.parse("明日の正午")    
=> Fri, 27 Apr 2012 12:00:00 +0900

time = jajp.parse("3日後の12時")    
=> Sun, 29 Apr 2012 12:00:00 +0900

time = jajp.parse("3日後の12時45分")    
=> Sun, 29 Apr 2012 12:45:00 +0900

time = jajp.parse("3日後の12:45:55")    
=> Sun, 29 Apr 2012 12:45:55 +0900

time = jajp.parse("3日12時間45分後")    
=> Mon, 30 Apr 2012 02:55:27 +0900

time = jajp.parse("1時間半後")    
=> Thu, 26 Apr 2012 15:40:27 +0900

time = jajp.parse("1分半後")    
=> Thu, 26 Apr 2012 14:11:57 +0900

time = jajp.parse("5時間半と1分半後")    
=> Thu, 26 Apr 2012 19:42:03 +0900

horai's People

Contributors

rummelonp avatar uneco avatar

Stargazers

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

Watchers

 avatar  avatar

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.