Skip to main content

Python wrapper of lightening fast Finite State machine and REgular expression manipulation library.

Project description

Bling Fire

Introduction

Hi, we are a team at Microsoft called Bling (Beyond Language Understanding), we help Bing be smarter. Here we wanted to share with all of you our FInite State machine and REgular expression manipulation library (FIRE). We use Fire for many linguistic operations inside Bing such as Tokenization, Multi-word expression matching, Unknown word-guessing, Stemming / Lemmatization just to mention a few.

Bling Fire Tokenizer

Bling Fire Tokenizer is a tokenizer designed for fast-speed and quality tokenization of Natural Language text. It mostly follows the tokenization logic of NLTK, except hyphenated words are split and a few errors are fixed. Currently released model supports most of the languages except East Asian (Chinese Simplified, Traditional, Japanese, Korean, Thai). You should expect good results if a language uses space as a main token delimitter. The tokenizer high level API designed in a way that it requires 0 configuration, or initialization, or additional files and is friendly for use from languages like Python, Perl, C#, Java, etc. It is fast as uses deterministic finite state machines underneath.

Benchmarking

Comparing Bling Fire with other popular NLP libraries, Bling Fire shows 10X faster speed in tokenization task

System Avg Run Time (Second Per 10,000 Passages)
Bling Fire 0.823
SpaCy 8.653
NLTK 17.821

See more at benchmark wiki

Getting Started

To start using Bling Fire Library and Finite State Machine manipulation tools, you can build the project on Windows/Linux with CMake. You need this if you want to create your own tokenization / segmentation, stemming etc. logic or need finite state machines for any other need. Read more here.

If you simply want to use it in Python, you can install the latest release using pip:

pip install blingfire

Example code

Python

from blingfire import *
text = 'This is the Bling-Fire tokenizer'
output = text_to_words(text)

Jupyter Notebook

This notebook demostrates how Bling Fire tokenizer helps in Stack Overflow posts classification problem.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Working Branch

To contribute directly to code base, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your personal workflow cruft out of sight.

Pull Request

Before we can accept a pull request from you, you'll need to sign a Contributor License Agreement (CLA). It is an automated process and you only need to do it once.

However, you don't have to do this up-front. You can simply clone, fork, and submit your pull-request as usual. When your pull-request is created, it is classified by a CLA bot. If the change is trivial (i.e. you just fixed a typo) then the PR is labelled with cla-not-required. Otherwise, it's classified as cla-required. In that case, the system will also tell you how you can sign the CLA. Once you have signed a CLA, the current and all future pull-requests will be labelled as cla-signed.

To enable us to quickly review and accept your pull requests, always create one pull request per issue and link the issue in the pull request if possible. Never merge multiple requests in one unless they have the same root cause. Besides, keep code changes as small as possible and avoid pure formatting changes to code that has not been modified otherwise.

Feedback

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blingfire-0.0.16.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

blingfire-0.0.16-py3-none-any.whl (2.8 MB view details)

Uploaded Python 3

File details

Details for the file blingfire-0.0.16.tar.gz.

File metadata

  • Download URL: blingfire-0.0.16.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for blingfire-0.0.16.tar.gz
Algorithm Hash digest
SHA256 f94fc6bd7593a0559c809806c8d22c5f37f3f60a33ed1c9b8c8d2030e7e655b2
MD5 d865f2bc0699c627ca6802741b1d6b8c
BLAKE2b-256 c0349cad95db77f65fd8f751e4d4cc3648b610fcd22cea40b5fc637d157125a7

See more details on using hashes here.

File details

Details for the file blingfire-0.0.16-py3-none-any.whl.

File metadata

  • Download URL: blingfire-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for blingfire-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 2b87e1d0a4f0fb781de640c2d2c8f1a9286c2a145491c1fca5146beef7357b0e
MD5 0bbf4d1f7f8d06b3f88f14800e59eab5
BLAKE2b-256 98b7efbc678f3d6ef59c0af9ed74943e77238bf7ec000b66f79231a4a4f19bde

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page