Read the Docs setup + Basic documentation files

This commit is contained in:
TrigonaMinima 2020-05-09 21:23:48 +05:30
parent 95cd77d827
commit f21b6e58dc
8 changed files with 455 additions and 1 deletions

5
.gitignore vendored
View File

@ -8,4 +8,7 @@ dist/
*.so
*.o
*.out
test.py
test.py
# Sphinx documentation
docs/_build/

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -0,0 +1,22 @@
.. RapidFuzz documentation master file, created by
sphinx-quickstart on Sat May 9 19:17:06 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
RapidFuzz Installation
=====================================
RapidFuzz can be installed using `pip <https://pypi.org/project/rapidfuzz/>`_.
.. code-block:: bash
pip install rapidfuzz
There are pre-built binaries (wheels) for ``RapidFuzz`` and its dependencies for MacOS (10.9 and later), Linux x86_64 and Windows.
For any other architecture/OS, ``RapidFuzz`` can be installed from the source distribution. To do so, a C++14 capable compiler must be installed before running the ``pip install rapidfuzz`` command. While Linux and MacOs usually come with a compiler it is required to install `C++-Buildtools <https://visualstudio.microsoft.com/visual-cpp-build-tools>`_ on Windows.
.. toctree::
:maxdepth: 2
:caption: Contents:

70
docs/_packages/usage.rst Normal file
View File

@ -0,0 +1,70 @@
.. RapidFuzz documentation master file, created by
sphinx-quickstart on Sat May 9 19:17:06 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
RapidFuzz Usage
=====================================
.. code-block:: console
> from rapidfuzz import fuzz
> from rapidfuzz import process
Simple Ratio
#####################
.. code-block:: console
> fuzz.ratio("this is a test", "this is a test!")
96.55171966552734
Partial Ratio
#####################
.. code-block:: console
> fuzz.partial_ratio("this is a test", "this is a test!")
100.0
Token Sort Ratio
#####################
.. code-block:: console
> fuzz.ratio("fuzzy wuzzy was a bear", "wuzzy fuzzy was a bear")
90.90908813476562
> fuzz.token_sort_ratio("fuzzy wuzzy was a bear", "wuzzy fuzzy was a bear")
100.0
Token Set Ratio
#####################
.. code-block:: console
> fuzz.token_sort_ratio("fuzzy was a bear", "fuzzy fuzzy was a bear")
83.8709716796875
> fuzz.token_set_ratio("fuzzy was a bear", "fuzzy fuzzy was a bear")
100.0
Process
#####################
.. code-block:: console
> choices = ["Atlanta Falcons", "New York Jets", "New York Giants", "Dallas Cowboys"]
> process.extract("new york jets", choices, limit=2)
[('new york jets', 100), ('new york giants', 78.57142639160156)]
> process.extractOne("cowboys", choices)
("dallas cowboys", 90)
.. toctree::
:maxdepth: 2
:caption: Contents:

195
docs/_static/RapidFuzz.svg vendored Normal file
View File

@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generated by Microsoft Visio, SVG Export RapidFuzz.svg Page-1 -->
<svg
xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="5.2963533in"
height="1.7699279in"
viewBox="0 0 381.33799 127.43484"
xml:space="preserve"
class="st6"
version="1.1"
id="svg933"
sodipodi:docname="RapidFuzz.svg"
style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-rule:evenodd;stroke-linecap:square;stroke-miterlimit:3"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
id="metadata939"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs937" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1137"
id="namedview935"
showgrid="false"
inkscape:zoom="0.60980132"
inkscape:cx="165.11513"
inkscape:cy="-104.98284"
inkscape:window-x="1592"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg933" />
<v:documentProperties
v:langID="1033"
v:metric="true"
v:viewMarkup="false">
<v:userDefs>
<v:ud
v:nameU="msvNoAutoConnect"
v:val="VT0(1):26" />
</v:userDefs>
</v:documentProperties>
<style
type="text/css"
id="style899">
<![CDATA[
.st1 {fill:none;stroke:#0070c0;stroke-linecap:round;stroke-linejoin:round;stroke-width:10}
.st2 {fill:#0070c0;stroke:#0070c0;stroke-linecap:round;stroke-linejoin:round;stroke-width:10}
.st3 {fill:none;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.75}
.st4 {fill:#0070c0;font-family:Calibri;font-size:5.33334em}
.st5 {fill:#ffffff;font-family:Calibri;font-size:5.33334em;font-style:italic}
.st6 {fill:none;fill-rule:evenodd;font-size:12px;overflow:visible;stroke-linecap:square;stroke-miterlimit:3}
]]>
</style>
<g
v:mID="0"
v:index="1"
v:groupContext="foregroundPage"
id="g931"
transform="translate(-142.402,-264.29138)">
<title
id="title901">Page-1</title>
<v:pageProperties
v:drawingScale="0.0393701"
v:pageScale="0.0393701"
v:drawingUnits="24"
v:shadowOffsetX="8.50394"
v:shadowOffsetY="-8.50394" />
<g
id="shape1-1"
v:mID="1"
v:groupContext="shape"
transform="translate(147.402,-208.549)">
<title
id="title903">Rectangle</title>
<v:userDefs>
<v:ud
v:nameU="visVersion"
v:val="VT0(15):26" />
</v:userDefs>
<rect
x="0"
y="477.84"
width="185.994"
height="117.435"
class="st1"
id="rect905"
style="fill:none;stroke:#0070c0;stroke-width:10;stroke-linecap:round;stroke-linejoin:round" />
</g>
<g
id="shape2-3"
v:mID="2"
v:groupContext="shape"
transform="translate(332.746,-208.549)">
<title
id="title908">Rectangle.2</title>
<v:userDefs>
<v:ud
v:nameU="visVersion"
v:val="VT0(15):26" />
</v:userDefs>
<rect
x="0"
y="477.84"
width="185.994"
height="117.435"
class="st2"
id="rect910"
style="fill:#0070c0;stroke:#0070c0;stroke-width:10;stroke-linecap:round;stroke-linejoin:round" />
</g>
<g
id="shape3-5"
v:mID="3"
v:groupContext="shape"
transform="translate(162.076,-256.961)">
<title
id="title913">Sheet.3</title>
<desc
id="desc915">Rapid</desc>
<v:textBlock
v:margins="rect(4,4,4,4)"
v:tabSpace="42.5197" />
<v:textRect
cx="78.322"
cy="584.97"
width="156.65"
height="20.611" />
<rect
x="0"
y="574.66498"
width="156.644"
height="20.611"
class="st3"
id="rect917"
style="fill:none;stroke:none;stroke-width:0.75;stroke-linecap:round;stroke-linejoin:round" />
<text
x="4.6500001"
y="604.16998"
class="st4"
v:langID="1031"
id="text919"
style="font-size:64.00008392px;font-family:Calibri;fill:#0070c0"><v:paragraph
v:horizAlign="1" /><v:tabList />Rapid</text>
</g>
<g
id="shape4-8"
v:mID="4"
v:groupContext="shape"
transform="translate(347.421,-256.961)">
<title
id="title922">Sheet.4</title>
<desc
id="desc924">Fuzz</desc>
<v:textBlock
v:margins="rect(4,4,4,4)"
v:tabSpace="42.5197" />
<v:textRect
cx="78.322"
cy="584.97"
width="156.65"
height="20.611" />
<rect
x="0"
y="574.66498"
width="156.644"
height="20.611"
class="st3"
id="rect926"
style="fill:none;stroke:none;stroke-width:0.75;stroke-linecap:round;stroke-linejoin:round" />
<text
x="21.879999"
y="604.16998"
class="st5"
v:langID="1031"
id="text928"
style="font-style:italic;font-size:64.00008392px;font-family:Calibri;fill:#ffffff"><v:paragraph
v:horizAlign="1" /><v:tabList />Fuzz</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

80
docs/conf.py Normal file
View File

@ -0,0 +1,80 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import datetime
# -- Project information -----------------------------------------------------
project = 'RapidFuzz'
copyright = str(datetime.datetime.now().year) + ", RapidFuzz Team"
author = 'RapidFuzz Team'
# html_logo = "_static/RapidFuzz.svg"
master_doc = "index"
version = ""
# release = ""
with open("../VERSION", "r") as version_file:
# release = version_file.read().strip()
version = version_file.read().strip()
release = version
html_theme_options = {
"fixed_sidebar": True,
'logo': 'RapidFuzz.svg',
"description": ("Rapid fuzzy string matching in Python and C++ using the "
"Levenshtein Distance"),
"sidebar_collapse": True,
"show_relbar_bottom": True,
"show_powered_by": False,
# 'github_user': "maxbachmann",
# 'github_repo': "rapidfuzz",
# "github_button": True,
# "github_type": "count",
# "github_banner": True,
}
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

29
docs/index.rst Normal file
View File

@ -0,0 +1,29 @@
.. RapidFuzz documentation master file, created by
sphinx-quickstart on Sat May 9 19:17:06 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
RapidFuzz
=====================================
Rapid fuzzy string matching in Python and C++ using the Levenshtein Distance.
------------------
RapidFuzz is a fast string matching library for Python and C++, which is using the string similarity calculations from `FuzzyWuzzy <https://github.com/seatgeek/fuzzywuzzy>`_. However there are two aspects that set RapidFuzz apart from FuzzyWuzzy:
1) It is MIT licensed so it can be used whichever License you might want to choose for your project, while you're forced to adopt the GPL license when using FuzzyWuzzy
2) It is mostly written in C++ and on top of this comes with a lot of Algorithmic improvements to make string matching even faster, while still providing the same results. More details on these performance improvements in form of benchmarks can be found in `Benchmarks.md <https://github.com/maxbachmann/rapidfuzz/blob/master/Benchmarks.md>`_.
Package Reference
##########################
.. toctree::
:maxdepth: 2
_packages/installation.rst
_packages/usage.rst

35
docs/make.bat Normal file
View File

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd