Skip to content

Kogia-sima/StringFilter

Repository files navigation

StringFilter Library

Build Status License: MIT gcc version clang version

This repository is no longer maintained

StringFilter is a fast filter for strings. You can use this filter for filtering large sentence set by complex conditions. Basic boolean operatoes (and, or, not) are supported.

For example, if you want to extract the sentences which has 'apple' or 'orange' keyword inside, you create filter object as StringFilter("apple or orange") and then check those sentences as fast as possible.

Prerequisite

  • CMake >= 2.8.12
  • C++ compiler with C++11 support
  • (Optional) Python 2.7 or 3.x

I have tested the program using the following compilers.

  • GNU GCC g++ (4.8.5)
  • Clang++ (3.7.1)

C++ API

Installation

$ git clone --recursive https://github.com/Kogia-sima/StringFilter.git
$ cd StringFilter
$ mkdir -p build
$ cd build
$ cmake -DBUILD_SHARED_LIBS=ON ..
$ make
$ sudo make install

Usage

#include <iostream>
#include <StringFilter/StringFilter.hpp>

int main() {
  using namespace std;

  StringFilter sf("rabbit and turtle");
  
  cout << boolalpha;
  cout << sf.is_valid("rabbit vs turtle") << endl;  // => true
  cout << sf.is_valid("Sea turtles were released to the ocean.") << endl;  // => false

  return 0;
}

Python API

Installation

$ pip install git+https://github.com/Kogia-sima/StringFilter.git

Example usage

import StringFilter

sf = StringFilter.StringFilter('rabbit and turtle')
print(sf.is_valid('rabbit vs turtle'))  # => True
print(sf.is_valid('Sea turtles were released to the ocean.'))  # => False

TODO

  • Performance test
  • namespace support
  • boolean operator for StringFilter class.
  • Case insensitive support.

About

Fast string filter library for C++ and python

Resources

License

Stars

Watchers

Forks

Packages

No packages published