The fuzzy-match Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The fuzzy-match Reference Manual

This is the fuzzy-match Reference Manual, version 0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 13:31:38 2020 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Fuzzy-match

Fuzzy match candidates from an input string.

On Ultralisp.

CL-USER> (fuzzy-match "hl" '("foo" "bar" "hello" "hey!"))
("hello" "hey!" "foo" "bar")
CL-USER> (fuzzy-match "zp" '("foo" "zepellin" "bar: zep"))
("zepellin" "bar: zep" "foo")

The parameters are hand-picked for the results to feel natural. A candidate that starts with the input substring should appear first. For example, we use the Damerau-Levenshtein distance thanks to the MK-STRING-METRICS library under the hood, but we don't obey to its result.

To give any objects as candidates, and not only strings, make them implement object-display, that returns a string representation.

Nyxt origin

This code was extracted from the Nyxt browser. Original authors: Ambrevar, Vindarel.

Licence

MIT


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 fuzzy-match

Maintainer

vindarel <vindarel@mailz.org>

Author

Nyxt project, Ambrevar, Vindarel

Home Page

https://github.com/vindarel/fuzzy-match

Source Control

(:git "git@github.com:vindarel/fuzzy-match.git")

Bug Tracker

https://github.com/vindarel/fuzzy-match/issues

License

MIT

Description

From a string input and a list of candidates, return the most relevant candidates first.

Long Description

# Fuzzy-match

Fuzzy match candidates from an input string.

On [Ultralisp](https://ultralisp.org/).

~~~lisp
CL-USER> (fuzzy-match "hl" ’("foo" "bar" "hello" "hey!"))
("hello" "hey!" "foo" "bar")
~~~

~~~lisp
CL-USER> (fuzzy-match "zp" ’("foo" "zepellin" "bar: zep"))
("zepellin" "bar: zep" "foo")
~~~

The parameters are hand-picked for the results to feel natural. A
candidate that starts with the input substring should appear
first. For example, we use the Damerau-Levenshtein distance thanks to
the ‘MK-STRING-METRICS‘ library under the hood, but we don’t obey to
its result.

To give any objects as candidates, and not only strings, make them
implement ‘object-display‘, that returns a string representation.

# Nyxt origin

This code was extracted from the Nyxt browser. Original authors: Ambrevar, Vindarel.

# Licence

MIT

Version

0.1

Dependencies
Source

fuzzy-match.asd (file)

Component

fuzzy-match.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 fuzzy-match.asd

Location

fuzzy-match.asd

Systems

fuzzy-match (system)


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 fuzzy-match/fuzzy-match.lisp

Parent

fuzzy-match (system)

Location

fuzzy-match.lisp

Packages

fuzzy-match

Exported Definitions

fuzzy-match (function)

Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 fuzzy-match

Source

fuzzy-match.lisp (file)

Use List

common-lisp

Exported Definitions

fuzzy-match (function)

Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: fuzzy-match INPUT SUGGESTIONS &key SUGGESTIONS-DISPLAY

From the user input and a list of suggestions, return a filtered list of suggestions that have all the input words in them, and sort this list to have the ’most relevant’ first.
The match is case-sensitive if INPUT contains at least one uppercase character. SUGGESTIONS-DISPLAY can be used to pass the pre-computed display strings of the suggestions; otherwise ‘object-display’ is used.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: score-threshold

The threshold under which suggestions are eleminated.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: file-suggestion-function INPUT FILES

Fuzzy-match this list of files.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)

Function: find-exactly-matching-substrings INPUT SUGGESTIONS &key SUBSTRING-LENGTH

Return the list of input substrings that match at least one suggestion. The substrings must be SUBSTRING-LENGTH characters long or more.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)

Function: keep-exact-matches-in-suggestions INPUT SUGGESTION-PAIRS

Destructively filter out non-exact matches from suggestions.
If any input substring matches exactly (but not necessarily a whole word),
then all suggestions that are not exactly matched by at least one substring are removed.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)

Function: score-suggestion INPUT SUGGESTION

Return a SUGGESTION’s score for INPUT.
A higher score means the suggestion comes first.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)

Function: sort-suggestions INPUT SUGGESTION-PAIRS

Sort SUGGESTION-PAIRS, the pair closest to INPUT in the levenshtein distance comes first. SUGGESTION-PAIRS is a list of (display-value real-value). See ‘fuzzy-match’ for
more details.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)

Function: substring-norm SUBSTRINGS STRING &key SUBSTRING-LENGTH

Return the norm of SUBSTRINGS with regard to STRING.
The norm is closer to 1 if
- substrings start near the beginning of STRING;
- substrings length are closer to the length of STRING.

Only substrings of SUBSTRING-LENGTH characters or more are considered.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)

Function: to-unicode INPUT

Convert INPUT to (simple-array character) type.

Package

fuzzy-match

Source

fuzzy-match.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Generic functions

Generic Function: object-display OBJ
Package

fuzzy-match

Methods
Method: object-display OBJ

Like ‘print-object’, but for fuzzy-match.

Source

fuzzy-match.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L  
Index Entry  Section

F
File, Lisp, fuzzy-match.asd: The fuzzy-match․asd file
File, Lisp, fuzzy-match/fuzzy-match.lisp: The fuzzy-match/fuzzy-match․lisp file
fuzzy-match.asd: The fuzzy-match․asd file
fuzzy-match/fuzzy-match.lisp: The fuzzy-match/fuzzy-match․lisp file

L
Lisp File, fuzzy-match.asd: The fuzzy-match․asd file
Lisp File, fuzzy-match/fuzzy-match.lisp: The fuzzy-match/fuzzy-match․lisp file

Jump to:   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   F   G   K   M   O   S   T  
Index Entry  Section

F
file-suggestion-function: Internal functions
find-exactly-matching-substrings: Internal functions
Function, file-suggestion-function: Internal functions
Function, find-exactly-matching-substrings: Internal functions
Function, fuzzy-match: Exported functions
Function, keep-exact-matches-in-suggestions: Internal functions
Function, score-suggestion: Internal functions
Function, sort-suggestions: Internal functions
Function, substring-norm: Internal functions
Function, to-unicode: Internal functions
fuzzy-match: Exported functions

G
Generic Function, object-display: Internal generic functions

K
keep-exact-matches-in-suggestions: Internal functions

M
Method, object-display: Internal generic functions

O
object-display: Internal generic functions
object-display: Internal generic functions

S
score-suggestion: Internal functions
sort-suggestions: Internal functions
substring-norm: Internal functions

T
to-unicode: Internal functions

Jump to:   F   G   K   M   O   S   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   S  
Index Entry  Section

S
score-threshold: Internal special variables
Special Variable, score-threshold: Internal special variables

Jump to:   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   F   P   S  
Index Entry  Section

F
fuzzy-match: The fuzzy-match system
fuzzy-match: The fuzzy-match package

P
Package, fuzzy-match: The fuzzy-match package

S
System, fuzzy-match: The fuzzy-match system

Jump to:   F   P   S