Skip to content

Commit 6f8f357

Browse files
committed
updated readme
1 parent 8e09d35 commit 6f8f357

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

README.rst

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ Fuzzymatches uses ``sqlite3``'s Full Text Search to find potential matches.
2121

2222
It then uses `probabilistic record linkage <https://en.wikipedia.org/wiki/Record_linkage#Probabilistic_record_linkage>`_ to score matches.
2323

24-
Finally it outputs a list of the matches it has found and associated score.
24+
Finally it outputs a list of the matches it has found and associated score.
25+
26+
27+
Installation
28+
------------
29+
30+
``pip install fuzzymatcher``
31+
32+
Note that you will need a build of sqlite which includes FTS4. This seems to be widely included by default, but otherwise `see here <https://www.sqlite.org/fts3.html#compiling_and_enabling_fts3_and_fts4>`_.
2533

2634
Usage
2735
-----
@@ -30,4 +38,51 @@ See `examples.ipynb <https://github.com/RobinL/fuzzymatcher/blob/master/examples
3038

3139
You can run these examples interactively `here <https://mybinder.org/v2/gh/RobinL/fuzzymatcher/master?filepath=examples.ipynb>`_.
3240

41+
Simple example
42+
--------------
43+
44+
Suppose you have a table called ``df_left`` which looks like this:
45+
46+
==== =============
47+
id ons_name
48+
==== =============
49+
0 Darlington
50+
1 Monmouthshire
51+
2 Havering
52+
3 Knowsley
53+
4 Charnwood
54+
... etc.
55+
==== =============
56+
57+
And you want to link it to a table ``df_right`` that looks like this:
58+
59+
==== =========================
60+
id
61+
==== =========================
62+
0 Darlington (B)
63+
1 Havering London Boro
64+
2 Sir Fynwy - Monmouthshire
65+
3 Knowsley District (B)
66+
4 Charnwood District (B)
67+
... etc.
68+
==== =========================
69+
70+
You can write:
71+
72+
.. code:: python
73+
74+
import fuzzymatcher
75+
fuzzymatcher.fuzzy_left_join(df_left, df_right, left_on = "ons_name", right_on = "os_name")
76+
77+
And you'll get:
3378

79+
================== ============= =========================
80+
best_match_score ons_name os_name
81+
================== ============= =========================
82+
0.178449 Darlington Darlington (B)
83+
0.133371 Monmouthshire Sir Fynwy - Monmouthshire
84+
0.102473 Havering Havering London Boro
85+
0.155775 Knowsley Knowsley District (B)
86+
0.155775 Charnwood Charnwood District (B)
87+
... etc. etc.
88+
================== ============= =========================

0 commit comments

Comments
 (0)