Coder Social home page Coder Social logo

dps's Introduction

Dynamic Programming Searcher

Dynamic Programming Searcher is a simple way to use Dynamic Programming to match charsequences and create smart searches on Android, Kotlin and Java 6+ projects.

Build Status

How to use

See the examples folder for more details.

1º Add JitPack to your build file

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

2º Add the gradle dependency

implementation 'com.github.ademar111190:dps:-SNAPSHOT'

3º Get a Builder instance for the class you want to search, in this example we want to search a Fruit class

Searcher.Builder<Fruit> builder = new Searcher.Builder<>();

4º Add algorithms, the library provide two (global and local) you can use it or you can implement your own.

builder.addLocalAlgorithm();
builder.addGlobalAlgorithm();
builder.dynamicProgramming( yourOwnAlgorithm );

5º Add the instaces you want to search and the text to use as term to the instance to be found

builder.searchable(new Orange(), "Orange");
builder.searchable(new Apple(), "Apple");
builder.searchable(new Banana(), "Banana");

6º Build the searcher

Searcher<Fruit> searcher = builder.build();

7º Search it

List<Fruit> result = searcher.search("orange");

Custom usage

You can customize the follow arguments using the builder:

  • threshold (The value to filter the searchables from 0 to 1)
  • normalized (true if should normalize the string false otherwise)
  • local / global (You can use both algorithms and/or provide a custom)
  • dynamicProgramming (A custom imlementation of Dynamic Programming)

Android

You can use the library as a normal java library or you can use a complete search here:

TODO link

Thread

The search can consume more time than you can allow in your thread, to avoid it you need to run in another thread, the easy way to do it is with Rx so you can check the Rx sample to see how to do it.

dps's People

Contributors

ademar111190 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.