Download ebooks file Make Python Talk Mark H Liu all chapters
Download ebooks file Make Python Talk Mark H Liu all chapters
com
https://ebookmeta.com/product/make-python-talk-mark-h-liu/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmeta.com/product/make-python-talk-1st-edition-mark-liu/
ebookmeta.com
Make Python Talk Build Apps with Voice Control and Speech
Recognition 1st Edition Mark Liu
https://ebookmeta.com/product/make-python-talk-build-apps-with-voice-
control-and-speech-recognition-1st-edition-mark-liu/
ebookmeta.com
https://ebookmeta.com/product/lets-talk-python-young-coders-build-
software-meap-v06-pavel-anni/
ebookmeta.com
https://ebookmeta.com/product/killer-fame-1st-edition-mary-stone-
stacy-o-hare/
ebookmeta.com
Atlas of Lip and Nose Plastic and Cosmetic Surgery Jianhua
Liu (Editor)
https://ebookmeta.com/product/atlas-of-lip-and-nose-plastic-and-
cosmetic-surgery-jianhua-liu-editor/
ebookmeta.com
https://ebookmeta.com/product/grumpy-girl-and-amaryllis-sunshine-guy-
grumpy-girl-romance-dirty-hoe-love-book-5-1st-edition-brynn-hale/
ebookmeta.com
https://ebookmeta.com/product/spectrums-of-amyotrophic-lateral-
sclerosis-heterogeneity-pathogenesis-and-therapeutic-directions-1st-
edition/
ebookmeta.com
https://ebookmeta.com/product/russian-imperialism-revisited-from-
disengagement-to-hegemony-1st-edition-domitilla-sagramoso/
ebookmeta.com
Narcocapitalism Life in the Age of Anaesthesia Theory
Redux 1st Edition Laurent De Sutter
https://ebookmeta.com/product/narcocapitalism-life-in-the-age-of-
anaesthesia-theory-redux-1st-edition-laurent-de-sutter/
ebookmeta.com
R L Y
A
E ESS
A C C
N O S TA R C H P R E S S
E A R LY A C C E S S P R O G R A M :
FEEDBACK W ELCOME!
Welcome to the Early Access edition of the as yet unpublished Make Python
Talk by Mark Liu! As a prepublication title, this book may be incomplete and
some chapters may not have been proofread.
Our goal is always to make the best books possible, and we look forward
to hearing your thoughts. If you have any comments or questions, email us
at earlyaccess@nostarch.com. If you have specific feedback for us, please
include the page number, book title, and edition date in your note, and
we’ll be sure to review it. We appreciate your help and support!
We’ll email you as new chapters become available. In the meantime,
enjoy!
M A K E P Y T H O N TA L K
MARK LIU
Early Access edition, 3/30/21
No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press,
Inc. Other product and company names mentioned herein may be the trademarks of their
respective owners. Rather than use a trademark symbol with every occurrence of a trade-
marked name, we are using the names only in an editorial fashion and to the benefit of the
trademark owner, with no intention of infringement of the trademark.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by
any means, electronic or mechanical, including photocopying, recording, or by any informa-
tion storage or retrieval system, without the prior written permission of the copyright owner
and the publisher.
The information in this book is distributed on an “As Is” basis, without warranty. While every
precaution has been taken in the preparation of this work, neither the author nor No Starch
Press, Inc. shall have any liability to any person or entity with respect to any loss or damage
caused or alleged to be caused directly or indirectly by the information contained in it.
CONTENTS
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Part I: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 1: Install Python via Anaconda and Spyder . . . . . . . . .
Chapter 2: Python Refresher . . . . . . . . . . . . . . . . . . . . . . . . . .
Part II: Learning to Talk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 3: Speech Recognition . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 4: Make Python Talk . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 5: Speaking Applications . . . . . . . . . . . . . . . . . . . . 17
Chapter 6: Web Scraping Podcasts, Radios, and Videos . . . . 39
Chapter 7: Building a Virtual Personal Assistant . . . . . . . . . . 61
Chapter 8: Know-it-all VPA . . . . . . . . . . . . . . . . . . . . . . . . . 83
Part III: Interactive Games . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 9: Graphics and Animation with the turtle Module . . . 95
Chapter 10: Tic-Tac-Toe . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Chapter 11: Connect Four . . . . . . . . . . . . . . . . . . . . . . . . 133
Chapter 12: guess-the-word Game . . . . . . . . . . . . . . . . . . 153
Chapter 13: Smart Games: Adding Intelligence . . . . . . . . . 167
Part IV: Going Further . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 14: Financial Applications . . . . . . . . . . . . . . . . . . 195
Chapter 15: Stock Market Watch . . . . . . . . . . . . . . . . . . . 219
Chapter 16: Use Other Languages: Translator
Chapter 17: Ultimate VPA
Appendix A: Useful Speech Modules
Appendix B: Answers to End of Chapter Exercises
Index
4
M A K E P Y T H O N TA L K
You’ll also learn how to ask Python to read a long text file such as a
news article aloud. Before you begin, set up the folder /mpt/ch04/ for this
chapter.
NE W SKILL S
Set Up
If you are using Windows, go to the “Install pyttsx3 in Windows” section
and skip the “Install gTTS in Mac or Linux” section. Otherwise, skip the
“Install pyttsx3 in Windows” section and go to the “Install gTTS in Mac or
Linux” section.
2 Chapter 4
Make Python Talk (Early Access) © 2021 by Mark Liu
import pyttsx3
1 engine = pyttsx3.init()
2 engine.say("hello, how are you?")
engine.runAndWait()
First import the pyttsx3 module to the script. Then use init() to initiate
a text-to-speech engine in the pyttsx3 module and call it engine 1. The say()
function in the pyttsx3 module converts the text to a speech signal, and
NOTE The say() function in the pyttsx3 module only converts the text to a speech signal
and prepares to send it to the speaker. It does not do the actual speaking. To hear the
sound, use runAndWait(), which sends the speech signal to the speaker.
If the module is correctly installed, when you finish running the whole
script, you should hear a voice saying, “Hello, how are you?” If not, recheck
the instructions and make sure that the speaker on your computer is work-
ing properly at the right volume. I’ll discuss later in this chapter how to cus-
tomize the speed, volume, and the voice gender associated with the pyttsx3
module.
If you are using Linux, run the following two commands on a terminal:
Once you’re finished, with your virtual environment activated, run the
following command in a terminal:
If you have correctly installed everything, you should hear a voice saying,
“Hello, how are you?” If not, recheck the instructions and make sure that the
speaker on your computer is working properly at the right volume. Further,
since you have installed the gTTS module in your virtual environment, you
have to run the preceding command with your virtual environment acti-
vated. Otherwise, it won’t work.
4 Chapter 4
Make Python Talk (Early Access) © 2021 by Mark Liu
import os
First import the os module to the script. Then use system()to execute a
command in a subshell to achieve the same effect of running the command
in a terminal. As a result, the gtts-cli tool is used to convert text to a file-like
object. After that, the mpg123 player plays the sound object so you can hear
a human voice.
NOTE You don’t need to explicitly import the gTTS module in test_gtts.py because you use
the gtts-cli tool in the command line, even though the gTTS module is used.
import pyttsx3
engine = pyttsx3.init()
1 while True:
2 inp = input("What do you want to covert to speech?\n")
3 if inp == "done":
print(f"You just typed in {inp}, goodbye!")
engine.say(f"You just typed in {inp}, goodbye!")
engine.runAndWait()
break
4 else:
print(f"You just typed in {inp}")
engine.say(f"You just typed in {inp}")
engine.runAndWait()
5 continue
import os
while True: 1
inp = input("What do you want to covert to speech?\n") 2
if inp == "done": 3
print(f"You just typed in {inp}, goodbye!")
os.system(f'gtts-cli --nocheck "You just typed in {inp}, goodbye!" | mpg123 -q -')
break
else: 4
print(f"You just typed in {inp}")
os.system(f'gtts-cli --nocheck "You just typed in {inp}" | mpg123 -q -')
continue 5
6 Chapter 4
Make Python Talk (Early Access) © 2021 by Mark Liu
If the text input is not done, the else branch runs 4, and the script speaks
your text input out loud in a human voice. After that, the script goes to the
next iteration and takes your text input again 5.
The following is sample output from the script (user input is in bold):
Repeat After Me
We’ll start with a simple script that hears what you say aloud and repeats it
in a human voice. This script serves two purposes. First, you’ll learn how the
script takes your voice inputs, and which words are easiest for the script to
understand—some uncommon words won’t be understood. Second, you’ll
learn how to put both the speech-recognition and text-to-speech features
in the same script, so you can communicate with the computer through
human voices only.
We’ll also make the script portable cross-platform. The script will auto-
matically choose the pyttsx3 module if you are using Windows and the gTTS
module otherwise.
Start a new script, name it repeat_me.py, and enter the code in Listing 4-3.
Make sure to save it in your chapter folder. You’ll also need to copy your
mysr.py file from Chapter 3 and paste it into the same folder, as we’ll need
voice_to_text() from that script.
# Make sure you put mysr.py in the same folder as this script
from mysr import voice_to_text
import platform 1
if platform.system() == "Windows":
import pyttsx3
engine = pyttsx3.init()
else:
import os
while True:
print('Python is listening...')
inp = voice_to_text() 2
if inp == "stop listening": 3
print(f'You just said {inp}; goodbye!')
if platform.system() == "Windows":
else:
print(f'You just said {inp}')
if platform.system() == "Windows": 4
engine.say(f'You just said {inp}')
engine.runAndWait()
else:
os.system(f'gtts-cli --nocheck "You just said {inp}" | mpg123 -q -')
continue
WARNING Remember to put mysr.py in the same folder as Listing 4-3. Otherwise, the speech-
recognition feature won’t work! Yes, I’ve said this before, but it bears repeating until it
sinks in.
Python is listening...
You just said hello
Python is listening...
You just said how are you
Python is listening...
You just said stop listening; goodbye!
NOTE If you pause often while the script stands by, the script may say, “You just said” in a
human voice again and again when you are not speaking. To avoid that, you can
modify repeat_me.py by removing the You just said part ( 4 in Listing 4-3).
8 Chapter 4
Make Python Talk (Early Access) © 2021 by Mark Liu
import pyttsx3
engine = pyttsx3.init()
1 voices = engine.getProperty('voices')
2 for voice in voices:
print(voice)
3 rate = engine.getProperty("rate")
print("the default speed of the speech is", rate)
vol = engine.getProperty("volume")
print("the default volume of the speech is", vol)
<Voice id=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_DAVID_11.0
name=Microsoft David Desktop - English (United States)
languages=[]
gender=None
age=None>
<Voice id=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0
name=Microsoft Zira Desktop - English (United States)
languages=[]
gender=None
age=None>
the default speed of the speech is 200
the default volume of the speech is 1.0
Here you can see the two voices available to the pyttsx3 module. The
first voice is named David with a male voice tone; the second voice is named
Zira with a female voice tone. The default voice tone is David, hence the
male voice you hear in test_pyttsx3.py.
The default speech speed is 200 words per minute. The default volume
is set at 1. You’ll learn how to adjust the speed, volume, and ID in the pyttsx3
module in Windows next.
import pyttsx3
engine = pyttsx3.init()
voice_id = 1
1 voices = engine.getProperty('voices')
2 engine.setProperty('voice', voices[voice_id].id)
3 engine.setProperty('rate', 150)
4 engine.setProperty('volume', 1.2)
5 engine.say("This is a test of my speech id, speed, and volume.")
engine.runAndWait()
Let’s choose the second voice ID, which has a female voice. At 1, the
script obtains the voice objects available in the text-to-speech engine and
saves them in a list called voices. We choose the second object in the list voices
by giving the index [1] 2, which has a female voice tone. The setProperty()
function takes two arguments: the property to set, and the value to set it to.
We set the value to voices[voiceID].id to choose the id value of the female
voice object in Windows, which is HKEY_LOCAL_MACHINE\SOFTWARE\
Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0. If you want to
change to the male voice in Windows, you can use voices[0].id instead.
Here we set the speech speed to 150 words per minute 3. Most of us
speak at the rate of about 125 words per minute in our daily lives. For faster
speech, set it to a number greater than 125, and for slower speech, set it to a
number below 125.
We set the volume to 1.2 4, which is louder than the default value of
1. You can set this to higher or lower than 1 based on your preference and
speakers.
At 5, the script converts the text in say() into speech by using the
adjusted properties. Try running this script multiple times with different
combinations of parameters until you find the best combination for you.
You can always come back to this script and adjust.
10 Chapter 4
Make Python Talk (Early Access) © 2021 by Mark Liu
import os
The script is the same as test_gtts.py you’ve created before except that it
adds the --slow option. This changes the voice output to slower than normal.
If you run this script in Mac or Linux, you’ll hear the computer saying,
“Hello, how are you?” in a slow pace.
Since the default setting for the speed is slow=False, and that’s what we
prefer, we won’t customize the gTTS module.
Create mysay
You’ll create a local module mysay and save it in the same folder as any script
that uses the text-to-speech feature. That way, you can save space in the main
script. This module has adjusted the properties for speed, volume, and gen-
der of the speech set in pyttsx3_adjust.py if you are using Windows. If you are
using Mac or Linux, the local module mysay will use the default properties
in the gTTS module. You can modify these parameters based on your own
preferences.
Enter the code in Listing 4-6 and save it as mysay.py in your chapter folder.
My dear Friend,
As to examples which are not good, I hope I may say, that all the
effect they can have upon my beloved friend (in her present happy
state of mind) will be to drive her nearer to her God, and in that
nearness what comfort does the believing soul find?
What tho’ earth and hell engage
Of persecution near.
Yes, my love, let those who stile themselves our best friends join
with the world in calling us mopes and enthusiasts. Still stedfastly
fixed on the rock which cannot be moved, we will endure, nay
joyfully take up the reproach for his sake, who hid not his blessed
face from shame and spitting for our sakes, to make us (accursed
and lost creatures) heirs of eternal glory. Oh that his strength may
but accompany us, and the light of his countenance continually
abide with us; and then we shall not fail to go on conquering and to
conquer. Amen.
For God’s sake avoid disputes of all kinds. I was delighted the last
time you was with me, to observe that you was greatly altered for
the better in this respect. Think not that I will omit to pray for you,
and fail not to pray for me. Oh my friend, soon will time be
swallowed up in eternity.
I READILY believe you, my dear friend, that you have not brought
back the same heart you carried with you: for I thought I
discovered the two last times I saw you, a falling off from the grace
you had, and the happy state of mind you had been in; but for God’s
sake strive to recover yourself before you are sunk lower. Think how
dreadful your case will be, if you should so grieve the Spirit of God,
as to cause him to depart from you. I know your heart to be
ungrateful and deceitful, and you yourself know full well how much it
is so; but fear not to search into its most hidden corruptions. Was it
ten times more vile and polluted than it is, the blood of Jesus is all-
sufficient to cleanse it. And my dear soul, let me intreat of you
earnestly to seek after a clear and constant sense of the pardoning
love of God. This only can enable you to trample all temptations
under your feet: believe me, unless you really walk in the light of his
countenance, you never can conquer all the powers and works of
darkness. Oh seek the peace which passes all understanding. You
have need enough of it, I am sure, considering the many snares you
walk in. I really fear you do not diligently seek after God: ’tis very
certain they that seek shall find; and therefore that the Redeemer is
not fully manifested in your soul is entirely owing to your sloth and
negligence. How is it possible for you to keep your ground against
temptations which are continually striking upon your senses, unless
you have in you the substance of things hoped for, the evidence of
things not seen? When our understandings are clear in gospel
doctrines, we are too apt to imagine our hearts are so. My dear
friend, for God’s sake deceive not yourself. Oh suffer not your soul to
rest, till you can say with full assurance of faith, “My sins are
forgiven.” Depend upon it this is the first step in true Christianity. Oh
cry to God every moment from the bottom of your heart, and he will
do more for you, than you can either ask or think. I am a witness of
his free and boundless mercy. For some days past I have been in the
wilderness, my soul weary, faint, and desolate; no rejoicing in God;
not one ray from the Sun of Righteousness: but this morning, this
blessed morning, my Beloved returned to my soul, and I rejoiced
with joy unspeakable, and could say with the fullest assurance, “My
sins are done away—Christ is mine—God the Father is my reconciled
Father—God the Holy Ghost is my comforter and guide.” *Oh my
friend, my heart is now so overwhelmed I can scarce write. I could
repeat a thousand and a thousand times over—Christ is mine. My
soul is ready to spring out of its prison, and I could at this moment
face death in all its horrible prospects to go to my Redeemer. Oh
death, where is thy sting? O grave, where is thy victory? My dear
love, you know not what you lose by your negligence. O seek, strive,
agonize; could you suffer the utmost tortures in body or mind, they
would be all as nothing to gain one moment of this sweetness: and
Oh pray for me, that I may not by sinning grieve the blessed
Comforter, and lose my present peace. God be with you my dear
friend. God bless you both now and for ever.
My dear friend,
I MOURN for you, and may you mourn too from your very inmost
soul, till God himself gives you the true comfort. Oh thou dear
backslider, what shall I say? How shall I find words strong enough to
make a lasting impression on a heart so inconstant, so slothful, and
careless? Oh that the Spirit of God would assist my weak
endeavours, and point my otherwise unavailing words! You own you
do not strive earnestly: alas I too plainly see you do not. But the
blessed Comforter strives with you, and still you resist and grieve
him. How irksome is it to me always to write the same thing? My
dear soul, for God’s sake be more in earnest. How can you talk of
sloth and carelessness, when you are standing on the brink of a
precipice? Can you promise yourself another day? And are you fit to
die in the state you are now in? Nay, are you not afraid to die? Oh if
the Lord should say of you, as of the barren fig-tree, “Cut it down,
why cumbereth it the ground,” how would you be overwhelmed with
dread and confusion? For you who know so well what are the
glorious promises of the gospel, to suffer your thoughts to run upon
worldly things is inexcusable. It seems strange, that you should think
you love Christ more than you did, when you was in a better state;
however above all things hold fast, and strive to increase this love,
but then at the same time take care that you hate sin in the same
proportion, and that you strive against it with the utmost
earnestness: for to talk of loving Christ, and at the same time to give
way to sloth, carelessness, and worldly-mindedness, is an
abominable mockery. If you are encompassed with ten thousand
temptations never fear, so your own heart consent not to them. Your
blessed Master will surely help you, if you can but trust him: and
never give way, to that seeming impossibility of praying. Though
perhaps you cannot pray with comfort, or with any kind of
connection, yet if you be ever so distracted you may surely cry, Lord,
have mercy upon me—Jesus, pity me. Or even supposing you could
not do this from your heart, ask yourself whether you do not desire
to pray; and if you do, thank God for that desire, and the next
thought will be prayer. Could you not make the increase of your
family profitable, by joining at stated times of the day in some act of
devotion? If it were but for one quarter of an hour at a time, there
would doubtless be a blessing attending it. Suppose you were to
sing an hymn together, or by turns pray, either from some form of
prayer, or what would be better, extempore. You ought rather to be
silent, and be thought a mope, than to join in trifling discourse.
Consider, my love, you are to set an example to your young friends;
and fear not but God will deliver you from this bondage into the
glorious liberty of his children. The feeble trust you now have is the
work of his blessed Spirit, and he will increase it into an holy
confidence. Let not therefore your comfort sicken, but trust in that
Jesus, who died that you might live; to whose all-merciful bosom I
commit you,
My dear Friend,
My dear Friend,
I T is impossible for me to judge rightly, till I know more of your
affair, and then I doubt not, but God, if we ask in sincerity, will
direct us both to agree in our sentiments, as to what will be most
conducive to your eternal welfare. However thus much I can say, be
not unequally yoked with an unbeliever. To marry a man in hopes of
making him a Christian, will be leading yourself into temptation. The
advantages you speak of may doubtless be great blessings to you, if
you are very certain you can enjoy them. You ought to be very
explicit with the person, whoever he is, both with regard to your
sentiments and his own heart. You cannot imagine the continual
snares you will walk in, if you are joined to one, who is not joined to
Christ; especially if you have any fondness for him. As in a married
state there are more allurements to draw the mind from God than in
a single one, so (if the companion be a Christian) there are also
advantages in it, which perhaps may almost make the balance even.
But how dreadful will it be, if he who should be your help, prove to
you an occasion of falling? Above all things, my dear, try the sincerity
of your own heart. Examine well whether you can accept this offer
with a single eye to the glory of God, and the good of your own
soul; and fear not, if you ask counsel of God in faith nothing
wavering, that he will give you freedom of mind, either to accept or
refuse as will be most profitable for you.
****
My dear Friend,
My dear Friend,
* R. V. has desired me to meet Dr. **** at his house; but though I
M honour the character of that worthy man, yet I rather fear,
than desire to do this. I really now dread the being set up as
something to be thought well of. I see such a depth of pride and
self-love in my own heart, that I dread any thing, which can give the
least food to these hellish tempers. I am well satisfied, that there
can be no perfect peace, no perfect love, till these be done away.
Was not the blessed Jesus meek and lowly of heart? Was not he
despised and rejected? And we? Oh, my dear love, tremble for
yourself and for me. We are esteemed, admired, and sought after.
Do we not, think you, tread upon burning coals? How dangerous,
how difficult to act for the glory of God, without sacrificing
something to self? And this self is all that separates from God—this
self is all that keeps the blessings both of time and eternity from our
souls. Oh let us learn, and know and feel, that we are nothing, and
that God is all in all. Certain it is that unless we die with Christ, we
cannot rise to his life. Unless we are crucified with him here, we
cannot reign with him hereafter. Let us then nail our corrupt nature
to his cross, and continually mortify every temper that is contrary to
his perfect will. Suffer we must; but the love of God will make all
sufferings sweet, and his grace will enable us to conquer all
difficulties. I rejoice at the victory, which you tell me has been given
you over (I suppose) some reigning sin. Is not this encouragement
to press forward? If you would preserve constant peace and
recollection, look more into your own heart, and lay not out yourself
too much upon others. I have seen so much of the ill effects of this,
that I dread it both for you and myself. Watch continually.
****
Y OUR letter, my dear life, has given me great pleasure. This is
indeed, as it ought to be. And Oh by no means suffer this
anxious desire after God, this thirst after holiness to abate; only let it
be mixed with that kind of resignation, which implies a willingness to
suffer, so you may be kept from sin. The pain you speak of I rejoice
in. Oh my love, this is right; and may you more and more be
conformed to Jesus Christ, and him crucified. A soul thus pained,
thus longing, thus struggling for salvation, and at the same time
lying low at the foot of the cross, and crying, “Lord thy will be done,”
is an object in which the holy angels rejoice, nay on which God
himself looks down well pleased. To such a soul every gospel
blessing is near at hand. The Sun of Righteousness is on the point of
rising in it with healing in his wings; the eternal Comforter is ready
to witness with it, that it is born of God, and to fill it with that peace,
which passeth all understanding. The blessed and adorable Trinity is
ready to raise it from its fallen state, and to perfect the new
creation. What encouraging prospects! Only let not this happy pain
be taken from you by any comfort the world can give, but hold it
dear to your heart, as light to your eyes, till God himself change it to
joy unspeakable.
*I have long thought that to wish for any thing, but the salvation
of our own souls and that of others is wrong: because in nothing
else can we be sure that our wishes are agreeable to the will of God.
I do not know how to believe, that you could wish for more riches;
and if the being pleased with the thoughts of gain proceeded only
from this motive, that you thought God was putting it more in your
power to relieve the necessities of others, I would not dare to
condemn you: but it is so difficult to take any satisfaction of this kind
without some mixture of worldly-mindedness, that we cannot be too
careful in this respect; nay we ought rather to fear lest we should
not be found faithful stewards of the talents put into our hands, as
knowing, that both in spiritual and temporal blessings, “To whom
much is given, of them shall much be required.”
My dear Friend,
My dear Friend,
*
WHERE the consideration of the prophecies is a means of stirring
any one up to greater diligence, or making them sit looser to
the things of this world, and seek more earnestly after the things of
God, they cannot consider them too attentively. Every soul should
carefully observe that way, in which God particularly leads it, and
punctually follow every means which it finds by experience brings it
nearer to God. Some are awakened and brought low by meditating
on the severe judgments of God; others are melted down by
reflecting on his mercies. Some are employed usefully to themselves,
and it may be to others, by accurately considering the several
amazing dispensations of God in the whole scheme of our
redemption. Others by a more simple and general view of God, as
infinite wisdom and infinite love, rest calmly on his will, and though
in a lower and less shining way, pursue the same end, viz. salvation
by the blood of the Lamb from the power as well as from the guilt of
sin, and union with the pure fountain of all happiness. All these ways
are good in themselves, and are made so to every soul, which in
them follows the leadings of the Spirit of God. But I may make that,
which is good in itself, evil to me, by using it only because another
thinks it right, and not because I find it the means which most unites
my soul to Christ; and therefore we ought never to blame any one
for not being affected by that which affects us.
’Tis very certain that the judgments of God are now abroad in
the earth, and that some of the signs of the last times plainly
appear; this (whether the calculation in the letter be right or wrong)
is obvious to every one, and calls aloud for seriousness and
watchfulness. Happy are those who shall stand unmoved in the time
of temptation. Happy are those who when all nature is agonizing
around them can fly to the only rock of refuge, and there find
shelter from the storm, and shadow from the heat. But above all
happy are those, who shall have the glory of suffering for their
Redeemer, of sealing their testimony with their blood, or in the midst
of the fire shouting for joy, and blessing God for a martyr’s crown.
These, these are glorious prospects, and weak as we are, should
God honour us with a trial like this, he would also give us strength to
be more than conquerors. In the mean time let us not be weary or
faint in our minds, but manfully fight till we obtain complete victory
over our evil hearts; and then shall we stand with humble
confidence even before our judge, and though all nature was
dissolved, we should remain unshaken, and be wholly swallowed up
in joy full of glory. Amen, Lord Jesus.
My dear Friend,
* THANK you for your last letter, and I bless God, that you was not
I offended at mine. This bearing of plain-dealing is a comfortable
proof to me of your sincerity. If temptations increase, God will give a
proportionable increase of strength. There wants nothing but
faithfulness on your part to the grace already given. I know not the
particulars of your sufferings, but I know it is good to suffer. It is a
discipline all must go through, who make any tolerable advance in
the school of Christ. I could wish you to seek more after religion,
than comfort. Constant and heart-felt resignation is a bulwark
against every trial, and a foundation for solid peace, and joy
transcendently pure. The whole state of a soul made perfect in love
stands in that one petition, Thy will be done: and if we could but
preserve that temper which these words describe, I know not what
could hurt us. Suppose now when I first wake in a morning I should
lift up my heart, “Lord I bless thee for this new day which thou hast
given me. In this day I shall have fresh manifestations of thy will
concerning me, either in comforts or in sufferings. Lord, I am thy
creature, deal with me as it shall please thee: only leave me not to
myself, but let thy grace be sufficient for me, and thy strength be
made perfect in my weakness.” When settled in this frame of mind,
suppose my trials to begin. I am tempted by the perverseness and
evil tempers of my own family to impatience, to anger; but I
immediately recollect myself, “Lord it is thy will I should bear this;
pardon their perverseness, and give me to be thankful for every
opportunity of self-denial and forbearance.” Well! now another, and
more difficult trial appears. I am to behave to people, whom I know
to be my bitter enemies, whom I know to be continually seeking
occasions of evil against me, as if they were my dear friends. Here
every faculty of the soul is alarmed, and nature shrinks back
affrighted. But what does grace say? “Lord I thank thee for this
glorious trial! What a blessing is it I should be permitted to drink of
the same cup my Saviour drank of! Oh bless these mine enemies; fill
their hearts with thy love; let thy will be perfected both in them and
me.” This temptation is conquered, but another and a more trying
one immediately succeeds. I am treated unkindly by people I love,
and who are really my friends. Here my heart is wounded, it sinks, it
is ready to faint; but recovering itself it rests upon God, and says,
“Lord, even in this, thy will be done, and let the sufferings of Christ
be perfected in me, that I may be also a partaker of his glory.” In
this manner one might instance in all kinds of affliction, and find
comfort and strength in each.
Dear Sir,
I AM much obliged to you for your kind concern on my account. My
illness I believe is rather troublesome than dangerous, a
disorder in my stomach, which has been attended with a slight fever.
I was ill, when you and Mr. **** were to see me though I did not
complain, and I looked upon it as a particular blessing: for had my
spirits been in their full flow, an event so much wished, would have
too much elated me: but my disorder served to keep the balance of
my mind even. I see the goodness of God to me in every thing, and
therefore sickness or health, life or death are equally welcome to
me, as coming from the same gracious hand. Nature, its true,
shrinks at suffering, but grace triumphs in resignation, and is
thankful for the dispensation of the present moment, without
wishing or willing in regard to the future. But I hope to learn some
lessons of this kind from you next Sunday. Till then farewell, and
may the fulness of every gospel blessing rest upon your soul.
Your’s, &c.
****
Dear Sir,
T HE judgments of God upon Lisbon are dreadful indeed. I know
not what heart can be hard enough to hear of them without
concern. What but the amazing mercy of a long-suffering God can
prevent London from feeling the same dreadful blow! And if God
should arise to shake terribly our land, what great reason will those
persons have to be thankful, whom God has drawn from all worldly
schemes of happiness, and fixed their hearts on a basis, which can
never be shaken, though the earth be moved, and the mountains
cast into the midst of the sea? I have been much comforted in
respect of the miseries of others by this scripture—When the
judgments of God are abroad in the earth, the inhabitants thereof
will learn righteousness. If such a blessed end is produced by these
severe acts of justice, have we not reason even in the midst of terror
to admire and adore? The whole universe appears to me to be in the
hand of God, as a grain of dust in the balance; and I, a creature
more insignificant, more worthless, and sinful than can be
conceived, am among the rest in this almighty hand, and all is safe.
My heart is by nature painfully tender, and yet in the midst of
feeling, either for myself or others, there is a secret satisfaction in
my inmost soul, that God is glorified in every act of his providence,
whether of judgment or mercy; and I hardly know how to form any
other prayer than Thy will be done.
****
Dear Sir,
I AM much obliged to you for your letter, from which I have learnt a
very useful lesson, viz. Never to fancy that the particular
circumstances of others would be more advantageous to me than
my own. You are ready almost to envy me my many hours of
retirement; when at the same time, I am continually complaining
that I have so few, and often crying out, when shall I have a whole
day to myself? And then I frequently think, were I a man and in the
ministry, my time would then be all spent for God; but now, what an
inundation of trifling flows in upon me, which ’tis impossible for me
to avoid, without altogether going out of the world.
I enter upon the subject, on which you bid me write with fear
and trembling. My abilities are really far from being equal to it: for
although I know many Christians, who would immediately cry out,
that it needed not one moment’s consideration, I dare not do so; for
I now really feel the weight of it upon my soul. *’Tis a most alarming
truth, that a minister may speak with the tongue of men and of
angels, and that the power of God may so accompany his words as
to make them the means of converting thousands; and yet for want
of duly searching into his own heart, he may suffer it to be
overgrown with poisonous weeds, with tempers and inclinations,
which if unsubdued, will absolutely shut him out from the kingdom
of glory, to which he is leading others. How easy for a man who is
continually setting forth the glorious truths of the gospel, and
inforcing holiness of heart and life, to imagine (for want of constant
self-examination) that he himself is what he preaches? This is a
most dangerous snare; and therefore how absolutely necessary is
that retirement which affords opportunity for a diligent search into
the recesses of the heart, and gives the soul leisure to wait in awful
silence before God, where, free from every object of sense, and from
the workings of imagination, it may with all its faculties prostrate
before the eternal Trinity, and feel itself to be nothing, and God to be
all in all? But then it may be asked, shall not a man who with
singleness of heart, spends and is spent for the service of God, be so
kept by divine grace, that his soul shall suffer no loss by the want of
retirement? Doubtless. Where sincerity and singleness of heart are
preserved, that soul shall be defended as with a shield. But this I
take to be the grand temptation of every minister of the gospel; he
sets out perhaps (though this is not always the case) with a single
view to the glory of God and the salvation of souls. The power of
God accompanies his words, the hearts of the people fall under him.
His reputation daily increases, till at last he becomes popular. He
sees himself surrounded by a croud of people, who for the most part
hear him as an angel of God, their thirsty souls gasping after the
truths he utters. An innocent and an holy joy fills his heart; “Here
are souls that may be won to Christ, and that by me! Lord, what
amazing love, that I who am the least of all thy servants should be
thus blest!”—So far all is well, all is happy: but the subtil enemy of
mankind so strongly impresses this, by me, that a self-complacency,
separate from the glory of God, arises in his heart, and this, if not
immediately quelled, leads him to the brink of a precipice. God still,
for the sake of others, continues his usefulness; but every
conversion which he is the means of making, is fresh food for his
self-love; and by degrees he becomes so dead to the love of God,
that he preaches even the purest doctrines of the gospel, with the
same spirit, with which a lawyer pleads at the bar. But on the
contrary, that blessed servant of Christ who stedfastly pursues the
narrow path, who conquers every rising of self-love in its first
appearance, and constantly refers all the good he does or speaks to
the author and giver of all good, he shall be kept in all his ways, and
blest in all his works. And though his soul may pant for retirement,
as thinking he should there enjoy nearer communion with God, and
make higher advances in the divine life, this may not perhaps be
immediately permitted him: but in order that his future crown may
be the brighter, God may make his present usefulness a sure sign to
him, that he ought to continue his constant labours for others,
though it should be with much temptation, fear, and trembling.
However this is very certain, that God to a servant thus sincere, will
point out a plain path, either by inward leadings which cannot be
mistaken, or outward providences.—Adieu! Pardon the weakness of
this; let me see you the first time you have to spare, and believe me
****
Dear Sir,
W HATEVER the Spirit of God makes useful to my heart, either
from scripture or from spiritual authors, I thankfully receive,
and give him the glory: but I well know there is but one great touch-
stone, by which all doctrines are to be tried; and therefore I hope
your kind fears for me, lest I should not enough esteem the written
word of God, are needless. I am so far from setting any human
writer on a footing with this, that I scarcely read them at all, i. e. in
comparison of my bible. I look over some few, but this is very
different from the manner of reading you recommend, and which I
strive by the grace of God to practise; nay, it would be the greatest
slavery to me you can conceive, if I were obliged to read many
religious books: however I return you the sincerest thanks for your
care, and beg you will in all things watch over me with a “godly
jealousy.”—But my dear friend, could you imagine that I enquired
after the state of your mind according to the common acceptation of
the word? I only desired to know what spiritual blessings you had
both from without and within, that I might share them with you. And
this I was emboldened to do by the sweet account you had given in
your former letter, of the blessings you enjoyed at Bristol. The Lord
refresh your soul continually with the rich streams of his redeeming
love, and may his everlasting arms be beneath you! I know your
present state, of hanging as it were in suspence between the visible
and invisible world, is a dispensation big with divine love. And was I
to pray for you that prayer which my soul most loves, it would be,
“that you should lie in the hand of God as an instrument, without
choice, till the will of God was perfected in you.” This would be the
prayer of pure love and enlightened faith; but if I descended to the
tenderness of friendship, I should ask your speedy recovery. If it
should be given me to see you again in this world of vanity and woe,
I shall be thankful, and perhaps it may be so: but I know not—
something seems to whisper me that the thread both of your life and
mine is nearly spun. For my part, I have within these few days had a
sweet call to eternity, by a sudden and violent disorder in my
stomach and bowels (called according to the fashionable phrase a
nervous cholick) which seems to have set me a good way forwards
on my journey. Happy pain! Kind messenger! O my friend, I have
nothing but mercies to tell you of. So supported! Such wonderous
grace! Such boundless love! I all sin and misery: the Saviour all
tenderness and mercy: the probable approach of death delightful: no
sting remaining. No clog upon my chariot-wheels. Mercies too from
without which I had never before experienced in a time of sickness.
The Rev. Mr. **** praying and singing by my bed, with such power
of faith and love, such unction from above! Does this hurry the
spirits? Does this endanger? How far from it? I protest not only my
soul rejoiced, but even my body grew better as he prayed. Do not
fail to thank God on my behalf, and pray for me that I may not be
ungrateful to such amazing mercy. May the Lord Jesus preserve you,
sweeten every pain, and make you rejoice continually with joy
unspeakable and full of glory.
****
June 7, 1756.
Dear Sir,
Y OUR very kind letter has pained me extremely, but I hope it has
been made a means of humbling my soul before God. How
little do I deserve that you should write to me in this manner? Alas
you do not know me; I am less than the least of all the mercies of
God; do not, I beseech you, think so highly of me; it really makes
me ashamed of myself. Oh that I could be lower than the dust! Oh
that I could shrink into nothing at the presence of my God! The way
too in which you speak of yourself, puts me in a strange dilemma, I
dare not pay religious compliments, and yet how shall I write to you,
as if I believed you? How much greater has your cross of sickness
been than mine? So long, so lingering, such inconveniences as it lays
you under. But yet this is certainly no excuse for a soul, taught of
God, as your’s is, to wish its removal. *Did you indeed wish for any
thing but sanctification? Surely, my dear friend, you wrong yourself;
it cannot be. Oh remember the glorious path you have often pointed
out to me, of perfect resignation! I have considered you as a pattern
to me, particularly in this. I must not think that you have any
“reluctance to bear the cross;” it would wound my heart too much.
Do I not know, that you love God above all things? Do not I know
the sincere desires of your soul after holiness? And is there any way
in the spiritual life, which so immediately leads to holiness, as willing
suffering? Happy are those to whom God gives the grace of doing
much for him, for his cause, for his people; but ten times more
blessed are they who suffer with Christ. Is there a joy absolutely
pure? It is that of suffering. Oh did we but know the health, the
peace, the life that is at the bottom of every bitter cup; with what
alacrity should we drink it? With what thankfulness, nay, with tears
of joy, should we cry, Lord, what unbounded mercy, what
astonishing grace is this, to a worm like me; that I should be led in
this most excellent way; that I should be made to tread in those
footsteps which are most eminently thine? Dearest Saviour, sweet is
thy cross, sweet is thy thorny crown; thy stripes, thy wounds, thy
pain, more delightful than beds of roses. Let other souls glory in
mount Tabor; my joy shall be to stay with thee on mount Calvary,
that I may be made conformable to thy death. Such would be the
language of a soul truly sensible of the great benefit of suffering,
and embracing, with sweet complacency, the cross, which thus
united it with its Redeemer. May this be the language of your soul
and mine; then shall we be found unshaken in the fiery trial, and
come out as gold purified seven times. But after all, what suffering
have I had in this illness? It can scarce be called suffering, when
God sensibly supports. The suffering is when he leaves the soul (as
it were alone) in pain or in affliction, to struggle with the powers of
darkness, which at such a time eagerly beset it. This I have
sometimes known, and this is suffering indeed.—I have the same
confidence in God for my dear Mr. ****, that you have. Was I to be
removed, I doubt not but it would be made a means of good to his
soul; but it seems at present to be the will of God that I should
continue some time longer. My inward weakness is not so great, and
my pain, though pretty constant, is so slight, that it is scarce worth
the mentioning. I thank God that your health is returning, and trust
we shall meet again on this side the river; but in the mean time pray
earnestly for me. I fear ease more than pain. Farewell! May you and
I constantly join in this prayer, “Thy will be done in us, and by us, in
time and in eternity!”
****
July 1, 1756.
My dear Friend,