Coder Social home page Coder Social logo

fonetic's Introduction


fonetic
Fonetic

assess pronounciblity of text

Introduction

Fonetic is a python library to assess pronounceablility of a given text based on an algorithm invented by Somdev Sangwan. A related research paper can be found here.

fonetic can be used in:

  • Detecting randomly generated strings
  • Heuristic checking for spell checkers
  • Improving made-up word generators
  • Optimizing brute-force attacks

Open an issue to extend this list.

fonetic has only 33 lines of executable code which is optimized to the boolean level. It has no external imports and it can be used with any Python version and operating system.

Installation

The recommended method to install fonetic is using pip, as follows:

pip install fonetic

Documentation

fonetic is minimal and can be implemented in just 2 lines of code as follows:

>>> from fonetic import count
>>> count('christmxs')
(8, 6, 2)

The output is a tuple containing values of total bigrams, pronounceable bigrams and unpronounceable bigrams respectively.

Benchmarking

The python script and related files used for benchmarking can be downloaded from here

The result below was produced by parsing a 4.3 MB text file containing the entire oxford dictionary with a 3GB RAM and a 4th Gen intel i3 processor.

~> python benchmark.py /root/oxford.txt

---Result---
- Text length: 4478566 bytes
- English text length: 3262241 bytes
- Total valid bigrams: 2566359
- Pronounceable bigrams: 2533266
- Unpronounceable bigrams: 33105
- Meaningful text: 98%

---Benchmark---
- Parsing started: 1577194614
- Parsing ended: 1577194616
- Time taken: 2 seconds

The error of 2% in Oxford dictionary was unexpected but manual checking revealed that it was caused by abbreviations and words from other languages. Such an entry is given below:

zygote  n. biol. cel
. biol. cell formed by the union of two
two gametes. [greek zugotos yoked: relat
tes. [greek zugotos yoked: related to *z
yoked: related to *zeugma]

fonetic's People

Contributors

s0md3v avatar

Watchers

 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.