Giter VIP home page Giter VIP logo

cl-homoglyph's Introduction

cl-homoglyph

A Common Lisp library for handling unicode homoglyphs.

The homoglyphs db format is as is used by https://github.com/codebox/homoglyph. The function (make-homoglyph-db-from-uri) without the optional uri parameter will default to loading that project's database directly from github.

I recognize that most of the work involved is in generating and maintaining the database. If you use this library then you'll most likely want to use the one generated by @codebox - so kudos are due that way, too.

Tested with SBCL and CLISP - I think it should be pretty close to modern "standard" Common Lisp, but YMMV.

Examples

CL-USER> (push #p"/home/ghard/src/cl-homoglyph/" ql:*local-project-directories*)

CL-USER> (ql:quickload :cl-homoglyph)
To load "cl-homoglyph":
  Load 1 ASDF system:
    cl-homoglyph
; Loading "cl-homoglyph"

(:CL-HOMOGLYPH)

CL-USER> (asdf:test-system 'cl-homoglyph)
T

CL-HOMOGLYPH> (setf *homoglyph-db* (make-homoglyph-db-from-uri)) ; this loads the homoglyph data from https://raw.githubusercontent.com/codebox/homoglyph/master/raw_data/char_codes.txt

(#<HASH-TABLE :TEST EQL :COUNT 4317 {10048BFA43}>
 #<HASH-TABLE :TEST EQL :COUNT 1852 {10048D3EC3}>)

CL-HOMOGLYPH> (homoglyphise-string "Rivon orin roviot torilla")
"๐“ก๐ข๐›Žo๐•Ÿโ€จo๐˜ณำ๐•Ÿโ€จ๐“ปo๏ฝ–โ…ฐo๐˜โ€ฏ๏ฝ”o๊ฎโ…ฐll๐–บ"
CL-HOMOGLYPH> (let* ((tstr "Mieleni minun tekevi, aivoni ajattelevi.")
                     (hstr (homoglyphise-string tstr)))
                (list tstr hstr (homoglyph-str-p tstr hstr)))
("Mieleni minun tekevi, aivoni ajattelevi."
 "โ„ณ๐—ถ๏ฝ…lโ„ฎ๐˜ฏโ…ˆโ€…๏ฝ๐–Ž๏ฝŽ๐•ฆีธโ€€๐“‰โ…‡๐—„๐’†๐‚๐œ„โ€šโ€ฉฮฑแŽฅ๐˜ƒo๐”ซห›โ€‰๐–†๐”ง๐—ฎ๐–™๐—๐”ขl๐“ฎ๐—๐•š๊˜Ž" T)

cl-homoglyph's People

Contributors

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