@@ -92,15 +92,15 @@ def set_custom_boundaries(doc):
9292 f"{ 'Text with Whitespace' :22} "
9393 f"{ 'Is Alphanum?' :15} "
9494 f"{ 'Is Punctuation?' :18} "
95- f"{ 'Is Stop Word?' :6 } "
95+ f"{ 'Is Stop Word?' } "
9696)
9797
9898for token in about_doc :
9999 print (
100100 f"{ str (token .text_with_ws ):22} "
101101 f"{ str (token .is_alpha ):15} "
102102 f"{ str (token .is_punct ):18} "
103- f"{ str (token .is_stop ):6 } "
103+ f"{ str (token .is_stop )} "
104104 )
105105
106106# %% Customizing the tokenizer to add a custom infix
@@ -170,7 +170,7 @@ def set_custom_boundaries(doc):
170170conference_help_doc = nlp (conference_help_text )
171171for token in conference_help_doc :
172172 if str (token ) != str (token .lemma_ ):
173- print (f"{ str (token ):>20} : { str (token .lemma_ ):20 } " )
173+ print (f"{ str (token ):>20} : { str (token .lemma_ )} " )
174174
175175# %% Making use of stop words to count words that aren't stop words
176176
@@ -180,14 +180,14 @@ def set_custom_boundaries(doc):
180180 " interested in learning Natural Language Processing."
181181 " There is a developer conference happening on 21 July"
182182 ' 2019 in London. It is titled "Applications of Natural'
183- ' Language Processing". There is a helpline number '
183+ ' Language Processing". There is a helpline number'
184184 " available at +44-1234567891. Gus is helping organize it."
185185 " He keeps organizing local Python meetups and several"
186186 " internal talks at his workplace. Gus is also presenting"
187187 ' a talk. The talk will introduce the reader about "Use'
188188 ' cases of Natural Language Processing in Fintech".'
189189 " Apart from his work, he is very passionate about music."
190- " Gus is learning to play the Piano. He has enrolled "
190+ " Gus is learning to play the Piano. He has enrolled"
191191 " himself in the weekend batch of Great Piano Academy."
192192 " Great Piano Academy is situated in Mayfair or the City"
193193 " of London and has world-class piano instructors."
@@ -223,7 +223,7 @@ def set_custom_boundaries(doc):
223223for token in about_doc [:5 ]:
224224 print (
225225 f"""
226- TOKEN: { str (token ):10 }
226+ TOKEN: { str (token )}
227227 =====
228228 TAG: { str (token .tag_ ):10} POS: { token .pos_ }
229229 EXPLANATION: { spacy .explain (token .tag_ )} """
@@ -249,7 +249,7 @@ def set_custom_boundaries(doc):
249249# Windows server needs to be manually changed to 127.0.0.1
250250
251251about_interest_text = (
252- "He is interested in learning" " Natural Language Processing."
252+ "He is interested in learning Natural Language Processing."
253253)
254254about_interest_doc = nlp (about_interest_text )
255255displacy .serve (about_interest_doc , style = "dep" )
0 commit comments