Skip to content

Commit 3a54422

Browse files
committed
fixing imports for linter
1 parent bff5d97 commit 3a54422

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

spacy/examples.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# %%
2+
import pathlib
3+
from collections import Counter
4+
5+
import textacy
6+
27
import spacy
8+
from spacy import displacy
39
from spacy.language import Language
10+
from spacy.matcher import Matcher
11+
from spacy.tokenizer import Tokenizer
412

513
nlp = spacy.load("en_core_web_sm")
614

@@ -17,7 +25,6 @@
1725

1826
# %% Reading text from a file instead
1927

20-
import pathlib
2128

2229
file_name = "introduction.txt"
2330
introduction_file_text = pathlib.Path(file_name).read_text()
@@ -111,8 +118,6 @@ def set_custom_boundaries(doc):
111118
print([token.text for token in nlp(custom_about_text)[8:15]])
112119

113120

114-
from spacy.tokenizer import Tokenizer
115-
116121
custom_nlp = spacy.load("en_core_web_sm")
117122
prefix_re = spacy.util.compile_prefix_regex(custom_nlp.Defaults.prefixes)
118123
suffix_re = spacy.util.compile_suffix_regex(custom_nlp.Defaults.suffixes)
@@ -174,7 +179,6 @@ def set_custom_boundaries(doc):
174179

175180
# %% Making use of stop words to count words that aren't stop words
176181

177-
from collections import Counter
178182

179183
complete_text = (
180184
"Gus Proto is a Python developer currently"
@@ -251,7 +255,6 @@ def set_custom_boundaries(doc):
251255

252256
# Windows server needs to be manually changed to 127.0.0.1
253257

254-
from spacy import displacy
255258

256259
about_interest_text = (
257260
"He is interested in learning" " Natural Language Processing."
@@ -292,7 +295,6 @@ def preprocess_token(token):
292295

293296
# %% Rule based matching
294297

295-
from spacy.matcher import Matcher
296298

297299
matcher = Matcher(nlp.vocab)
298300

@@ -310,7 +312,6 @@ def extract_full_name(nlp_doc):
310312

311313
# %% Extracting phone numbers from text with patterns
312314

313-
from spacy.matcher import Matcher
314315

315316
matcher = Matcher(nlp.vocab)
316317
conference_org_text = (
@@ -406,7 +407,6 @@ def flatten_tree(tree):
406407

407408
# %% Verb phrase detection
408409

409-
import textacy
410410

411411
about_talk_text = (
412412
"In this talk, the speaker will introduce the audience to the use"

0 commit comments

Comments
 (0)