Skip to content

6thsolution/ApexNLP

Repository files navigation

Build Status Latest Version codecov GitHub Issues GitHub Stars

A natural language processing tool that makes it easy to create events like Piano lessons Tuesdays at 6pm.

ApexNLP is a deterministic rule-based system designed for recognizing and normalizing different formats of event expressions. It will convert given sentences to a simple Event class. Out-of-the-box, it expects and processes English language text. But, it was designed to work with multiple human languages

Overview

There are many date/time parsers like natty or chrono. But ApexNLP is not another date/time parser, It is an event parser with some NLP tasks which helps you to easily create a calendar Event. It supports most event formats from simple to complex such as:

  • Family Dine Out on the 2nd Friday of every month at 6-9p
  • Meet John on monday at Mall
  • Tennis on Mondays, Tuesdays, Fridays at 10
  • Paying bills day repeat on the 3rd Tuesday of each month
  • Piano lessons Tuesdays and Thursdays at 5-6pm from 1/21 to 2/23
  • Meeting with John tomorrow every day until 12.10.2018"

Here are some sample outputs:

input sentence: Lunch at noon for 30 minutes

event response:

{
  "title" : "Lunch",
  "location" : "",
  "startDateTime" : "2017/4/13 12:00",
  "endDateTime" : "2017/4/13 12:30",
  "isAllDay" : false,
  "recurrence" : null
}

input sentence: Family Vacation at Singapore from 12/4 for six days:

event response:

{
  "title" : "Family Vacation ",
  "location" : "Singapore",
  "startDateTime" : "2017/12/04",
  "endDateTime" : "2017/12/09",
  "isAllDay" : true,
  "recurrence" : null
}

Features

  • Robust and Fast
  • Easy to Use
  • Support Multi Languages
  • Written in Java and support Android
  • Support most date/time formats

Installation

First add our repository:

repositories {
    //...
    maven {
        url  "http://dl.bintray.com/6thsolution/apexnlp"
    }

}

Then add needed libraries:

dependencies{
    //ApexNLP core library
    compile 'com.sixthsolution.apex:apex:0.1.0-alpha1'
    //NLP for English
    compile 'com.sixthsolution.apex:english-nlp:0.1.0-alpha1'
    //ThreeTen 
    compile 'org.threeten:threetenbp:1.3.3'
}

Note: If you are using android, replace threeten dependency with ThreeTenABP

Example

Below you can see a sample usage of ApexNLP in android:

public class ExampleApplication extends Application {

  @Override public void onCreate() {
    super.onCreate();
    Apex.init(new Apex.ApexBuilder()
                 .addParser("en", new EnglishParser())
                    .build()); 
  }
  
}

public class ExampleActivity extends Activity {

  public Event getEvent(String sentence){
    return Apex.nlp("en", sentence);                    
  }
  
}

Documentation

Usage Workflows

How to use ApexNLP and its features.

API Reference

Java doc for ApexNLP's API.

Multiple Languages Support

How to add and support a new language to the ApexNLP project.

License

Copyright 2017 6thSolution Technologies Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Releases

No releases published

Packages

No packages published