Skip to content

Commit 3ff4b87

Browse files
committed
sync with upstream master
1 parent 7ec042e commit 3ff4b87

File tree

102 files changed

+0
-2186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+0
-2186
lines changed

CONTRIBUTING.md

-4
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@ so it only becomes visible on click, making the issue easier to read and follow.
7373
### Issue labels
7474

7575
To distinguish issues that are opened by us, the maintainers, we usually add a
76-
<<<<<<< HEAD
77-
💫 to the title. [See this page](https://github.com/explosion/spaCy/labels)
78-
=======
7976
💫 to the title. [See this page](https://github.com/explosion/spaCy/labels)
80-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
8177
for an overview of the system we use to tag our issues and pull requests.
8278

8379
## Contributing to the code base

README.rst

-11
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ integration. It's commercial open-source software, released under the MIT licens
4949
`New in v2.0`_ New features, backwards incompatibilities and migration guide.
5050
`API Reference`_ The detailed reference for spaCy's API.
5151
`Models`_ Download statistical language models for spaCy.
52-
<<<<<<< HEAD
53-
`Resources`_ Libraries, extensions, demos, books and courses.
54-
=======
5552
`Universe`_ Libraries, extensions, demos, books and courses.
56-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
5753
`Changelog`_ Changes and version history.
5854
`Contribute`_ How to contribute to the spaCy project and code base.
5955
=================== ===
@@ -63,11 +59,7 @@ integration. It's commercial open-source software, released under the MIT licens
6359
.. _Usage Guides: https://spacy.io/usage/
6460
.. _API Reference: https://spacy.io/api/
6561
.. _Models: https://spacy.io/models
66-
<<<<<<< HEAD
67-
.. _Resources: https://spacy.io/usage/resources
68-
=======
6962
.. _Universe: https://spacy.io/universe
70-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
7163
.. _Changelog: https://spacy.io/usage/#changelog
7264
.. _Contribute: https://github.com/explosion/spaCy/blob/master/CONTRIBUTING.md
7365

@@ -207,14 +199,11 @@ or manually by pointing pip to a path or URL.
207199
# pip install .tar.gz archive from path or URL
208200
pip install /Users/you/en_core_web_sm-2.0.0.tar.gz
209201
210-
<<<<<<< HEAD
211-
=======
212202
If you have SSL certification problems, SSL customization options are described in the help:
213203

214204
# help for the download command
215205
python -m spacy download --help
216206

217-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
218207
Loading and using models
219208
------------------------
220209

examples/information_extraction/phrase_matcher.py

-3
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@
3434
{"text":"Appalachia"}
3535
{"text":"Argentina"}
3636
37-
<<<<<<< HEAD
38-
=======
3937
Reddit comments corpus:
4038
* https://files.pushshift.io/reddit/
4139
* https://archive.org/details/2015_reddit_comments_corpus
4240
43-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
4441
Compatible with: spaCy v2.0.0+
4542
"""
4643
from __future__ import print_function, unicode_literals, division

examples/pipeline/custom_component_countries_api.py

-6
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,9 @@ def __init__(self, nlp, label='GPE'):
6868
# the matches, so we're only setting a default value, not a getter.
6969
# If no default value is set, it defaults to None.
7070
Token.set_extension('is_country', default=False)
71-
<<<<<<< HEAD
72-
Token.set_extension('country_capital')
73-
Token.set_extension('country_latlng')
74-
Token.set_extension('country_flag')
75-
=======
7671
Token.set_extension('country_capital', default=False)
7772
Token.set_extension('country_latlng', default=False)
7873
Token.set_extension('country_flag', default=False)
79-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
8074

8175
# Register attributes on Doc and Span via a getter that checks if one of
8276
# the contained tokens is set to is_country == True.

examples/training/train_textcat.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/usr/bin/env python
22
# coding: utf8
3-
<<<<<<< HEAD
4-
"""Train a multi-label convolutional neural network text classifier on the
5-
=======
63
"""Train a convolutional neural network text classifier on the
7-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
84
IMDB dataset, using the TextCategorizer component. The dataset will be loaded
95
automatically via Thinc's built-in dataset loader. The model is added to
106
spacy.pipeline, and predictions are available via `doc.cats`. For more details,

requirements.txt

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ plac<1.0.0,>=0.9.6
99
ujson>=1.35
1010
dill>=0.2,<0.3
1111
regex==2017.4.5
12-
<<<<<<< HEAD
13-
pytest>=3.0.6,<4.0.0
14-
=======
1512
requests>=2.13.0,<3.0.0
1613
pytest>=3.6.0,<4.0.0
17-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
1814
mock>=2.0.0,<3.0.0

setup.py

-4
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,8 @@ def setup_package():
195195
'pathlib',
196196
'ujson>=1.35',
197197
'dill>=0.2,<0.3',
198-
<<<<<<< HEAD
199-
'regex==2017.4.5'],
200-
=======
201198
'regex==2017.4.5',
202199
'requests>=2.13.0,<3.0.0'],
203-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
204200
classifiers=[
205201
'Development Status :: 5 - Production/Stable',
206202
'Environment :: Console',

spacy/__init__.py

-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,5 @@ def blank(name, **kwargs):
2020
return LangClass(**kwargs)
2121

2222

23-
<<<<<<< HEAD
24-
def info(model=None, markdown=False):
25-
return cli_info(model, markdown)
26-
=======
2723
def info(model=None, markdown=False, silent=False):
2824
return cli_info(model, markdown, silent)
29-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c

spacy/cli/_messages.py

-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ class Messages(object):
77
M002 = ("Creating a shortcut link for 'en' didn't work (maybe you "
88
"don't have admin permissions?), but you can still load the "
99
"model via its full package name: nlp = spacy.load('{name}')")
10-
<<<<<<< HEAD
11-
M003 = ("Server error ({code}: {desc})")
12-
=======
1310
M003 = ("Server error ({code})")
14-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
1511
M004 = ("Couldn't fetch {desc}. Please find a model for your spaCy "
1612
"installation (v{version}), and download it manually. For more "
1713
"details, see the documentation: https://spacy.io/usage/models")

spacy/cli/download.py

-48
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
from __future__ import unicode_literals
33

44
import plac
5-
<<<<<<< HEAD
6-
import os
7-
import subprocess
8-
import sys
9-
import ujson
10-
11-
from .link import link
12-
from ._messages import Messages
13-
from ..util import prints, get_package_path
14-
from ..compat import url_read, HTTPError
15-
=======
165
import requests
176
import os
187
import subprocess
@@ -21,45 +10,30 @@
2110
from ._messages import Messages
2211
from .link import link
2312
from ..util import prints, get_package_path
24-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
2513
from .. import about
2614

2715

2816
@plac.annotations(
2917
model=("model to download, shortcut or name)", "positional", None, str),
3018
direct=("force direct download. Needs model name with version and won't "
31-
<<<<<<< HEAD
32-
"perform compatibility check", "flag", "d", bool))
33-
def download(model, direct=False):
34-
=======
3519
"perform compatibility check", "flag", "d", bool),
3620
pip_args=("additional arguments to be passed to `pip install` when "
3721
"installing the model"))
3822
def download(model, direct=False, *pip_args):
39-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
4023
"""
4124
Download compatible model from default download path using pip. Model
4225
can be shortcut, model name or, if --direct flag is set, full model name
4326
with version.
4427
"""
4528
if direct:
46-
<<<<<<< HEAD
47-
dl = download_model('{m}/{m}.tar.gz'.format(m=model))
48-
=======
4929
dl = download_model('{m}/{m}.tar.gz#egg={m}'.format(m=model), pip_args)
50-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
5130
else:
5231
shortcuts = get_json(about.__shortcuts__, "available shortcuts")
5332
model_name = shortcuts.get(model, model)
5433
compatibility = get_compatibility()
5534
version = get_version(model_name, compatibility)
56-
<<<<<<< HEAD
57-
dl = download_model('{m}-{v}/{m}-{v}.tar.gz'.format(m=model_name,
58-
v=version))
59-
=======
6035
dl = download_model('{m}-{v}/{m}-{v}.tar.gz#egg={m}=={v}'
6136
.format(m=model_name, v=version), pip_args)
62-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
6337
if dl != 0: # if download subprocess doesn't return 0, exit
6438
sys.exit(dl)
6539
try:
@@ -68,12 +42,7 @@ def download(model, direct=False, *pip_args):
6842
# package, which fails if model was just installed via
6943
# subprocess
7044
package_path = get_package_path(model_name)
71-
<<<<<<< HEAD
72-
link(model_name, model, force=True,
73-
model_path=package_path)
74-
=======
7545
link(model_name, model, force=True, model_path=package_path)
76-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
7746
except:
7847
# Dirty, but since spacy.download and the auto-linking is
7948
# mostly a convenience wrapper, it's best to show a success
@@ -82,20 +51,11 @@ def download(model, direct=False, *pip_args):
8251

8352

8453
def get_json(url, desc):
85-
<<<<<<< HEAD
86-
try:
87-
data = url_read(url)
88-
except HTTPError as e:
89-
prints(Messages.M004.format(desc, about.__version__),
90-
title=Messages.M003.format(e.code, e.reason), exits=1)
91-
return ujson.loads(data)
92-
=======
9354
r = requests.get(url)
9455
if r.status_code != 200:
9556
prints(Messages.M004.format(desc=desc, version=about.__version__),
9657
title=Messages.M003.format(code=r.status_code), exits=1)
9758
return r.json()
98-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
9959

10060

10161
def get_compatibility():
@@ -117,18 +77,10 @@ def get_version(model, comp):
11777
return comp[model][0]
11878

11979

120-
<<<<<<< HEAD
121-
def download_model(filename):
122-
download_url = about.__download_url__ + '/' + filename
123-
return subprocess.call(
124-
[sys.executable, '-m', 'pip', 'install', '--no-cache-dir', '--no-deps',
125-
download_url], env=os.environ.copy())
126-
=======
12780
def download_model(filename, user_pip_args=None):
12881
download_url = about.__download_url__ + '/' + filename
12982
pip_args = ['--no-cache-dir', '--no-deps']
13083
if user_pip_args:
13184
pip_args.extend(user_pip_args)
13285
cmd = [sys.executable, '-m', 'pip', 'install'] + pip_args + [download_url]
13386
return subprocess.call(cmd, env=os.environ.copy())
134-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c

spacy/cli/info.py

-16
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@
1313

1414
@plac.annotations(
1515
model=("optional: shortcut link of model", "positional", None, str),
16-
<<<<<<< HEAD
17-
markdown=("generate Markdown for GitHub issues", "flag", "md", str))
18-
def info(model=None, markdown=False):
19-
=======
2016
markdown=("generate Markdown for GitHub issues", "flag", "md", str),
2117
silent=("don't print anything (just return)", "flag", "s"))
2218
def info(model=None, markdown=False, silent=False):
23-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
2419
"""Print info about spaCy installation. If a model shortcut link is
2520
speficied as an argument, print model information. Flag --markdown
2621
prints details in Markdown for easy copy-pasting to GitHub issues.
@@ -39,16 +34,6 @@ def info(model=None, markdown=False, silent=False):
3934
meta['source'] = path2str(model_path.resolve())
4035
else:
4136
meta['source'] = path2str(model_path)
42-
<<<<<<< HEAD
43-
print_info(meta, 'model %s' % model, markdown)
44-
else:
45-
data = {'spaCy version': about.__version__,
46-
'Location': path2str(Path(__file__).parent.parent),
47-
'Platform': platform.platform(),
48-
'Python version': platform.python_version(),
49-
'Models': list_models()}
50-
print_info(data, 'spaCy', markdown)
51-
=======
5237
if not silent:
5338
print_info(meta, 'model %s' % model, markdown)
5439
return meta
@@ -60,7 +45,6 @@ def info(model=None, markdown=False, silent=False):
6045
if not silent:
6146
print_info(data, 'spaCy', markdown)
6247
return data
63-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
6448

6549

6650
def print_info(data, title, markdown):

spacy/cli/train.py

-18
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ def train(lang, output_dir, train_data, dev_data, n_iter=30, n_sents=0,
116116
optimizer = nlp.begin_training(lambda: corpus.train_tuples, device=use_gpu)
117117
nlp._optimizer = None
118118

119-
<<<<<<< HEAD
120-
print("Itn.\tP.Loss\tN.Loss\tUAS\tNER P.\tNER R.\tNER F.\tTag %\tToken %")
121-
=======
122119
print("Itn. Dep Loss NER Loss UAS NER P. NER R. NER F. Tag % Token % CPU WPS GPU WPS")
123-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
124120
try:
125121
train_docs = corpus.train_docs(nlp, projectivize=True, noise_level=0.0,
126122
gold_preproc=gold_preproc, max_length=0)
@@ -211,19 +207,6 @@ def print_progress(itn, losses, dev_scores, cpu_wps=0.0, gpu_wps=0.0):
211207
scores.update(dev_scores)
212208
scores['cpu_wps'] = cpu_wps
213209
scores['gpu_wps'] = gpu_wps or 0.0
214-
<<<<<<< HEAD
215-
tpl = '\t'.join((
216-
'{:d}',
217-
'{dep_loss:.3f}',
218-
'{ner_loss:.3f}',
219-
'{uas:.3f}',
220-
'{ents_p:.3f}',
221-
'{ents_r:.3f}',
222-
'{ents_f:.3f}',
223-
'{tags_acc:.3f}',
224-
'{token_acc:.3f}',
225-
'{cpu_wps:.1f}',
226-
=======
227210
tpl = ''.join((
228211
'{:<6d}',
229212
'{dep_loss:<10.3f}',
@@ -235,7 +218,6 @@ def print_progress(itn, losses, dev_scores, cpu_wps=0.0, gpu_wps=0.0):
235218
'{tags_acc:<8.3f}',
236219
'{token_acc:<9.3f}',
237220
'{cpu_wps:<9.1f}',
238-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
239221
'{gpu_wps:.1f}',
240222
))
241223
print(tpl.format(itn, **scores))

spacy/cli/validate.py

-15
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@
55
from pathlib import Path
66
import sys
77
import ujson
8-
<<<<<<< HEAD
9-
10-
from ._messages import Messages
11-
from ..compat import path2str, locale_escape, url_read, HTTPError
12-
=======
138
import requests
149

1510
from ._messages import Messages
1611
from ..compat import path2str, locale_escape
17-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
1812
from ..util import prints, get_data_path, read_json
1913
from .. import about
2014

@@ -23,20 +17,11 @@ def validate():
2317
"""Validate that the currently installed version of spaCy is compatible
2418
with the installed models. Should be run after `pip install -U spacy`.
2519
"""
26-
<<<<<<< HEAD
27-
try:
28-
data = url_read(about.__compatibility__)
29-
except HTTPError as e:
30-
title = Messages.M003.format(code=e.code, desc=e.reason)
31-
prints(Messages.M021, title=title, exits=1)
32-
compat = ujson.loads(data)['spacy']
33-
=======
3420
r = requests.get(about.__compatibility__)
3521
if r.status_code != 200:
3622
prints(Messages.M021, title=Messages.M003.format(code=r.status_code),
3723
exits=1)
3824
compat = r.json()['spacy']
39-
>>>>>>> 14d9007efd2ca457c6e6549d5599e460e198904c
4025
current_compat = compat.get(about.__version__)
4126
if not current_compat:
4227
prints(about.__compatibility__, exits=1,

0 commit comments

Comments
 (0)