Auto-format code with black (#10333)

Co-authored-by: explosion-bot <explosion-bot@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2022-02-21 09:15:42 +01:00 committed by GitHub
parent 28ba31e793
commit 6de84c8757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View File

@ -64,9 +64,7 @@ def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]:
prev_end = right_end.i
left_index = word.left_edge.i
left_index = (
left_index + 1 if word.left_edge.pos == adp_pos else left_index
)
left_index = left_index + 1 if word.left_edge.pos == adp_pos else left_index
yield left_index, right_end.i + 1, np_label
elif word.dep == conj_label:

View File

@ -99,7 +99,7 @@ def try_mecab_import() -> None:
return MeCab
except ImportError:
raise ImportError(
"The Korean tokenizer (\"spacy.ko.KoreanTokenizer\") requires "
'The Korean tokenizer ("spacy.ko.KoreanTokenizer") requires '
"[mecab-ko](https://bitbucket.org/eunjeon/mecab-ko/src/master/README.md), "
"[mecab-ko-dic](https://bitbucket.org/eunjeon/mecab-ko-dic), "
"and [natto-py](https://github.com/buruzaemon/natto-py)"

View File

@ -320,7 +320,7 @@ class TextCategorizer(TrainablePipe):
self._validate_categories(examples)
truths, not_missing = self._examples_to_truth(examples)
not_missing = self.model.ops.asarray(not_missing) # type: ignore
d_scores = (scores - truths)
d_scores = scores - truths
d_scores *= not_missing
mean_square_error = (d_scores**2).mean()
return float(mean_square_error), d_scores

View File

@ -107,7 +107,17 @@ FI_NP_TEST_EXAMPLES = [
(
"New York tunnetaan kaupunkina, joka ei koskaan nuku",
["PROPN", "PROPN", "VERB", "NOUN", "PUNCT", "PRON", "AUX", "ADV", "VERB"],
["obj", "flat:name", "ROOT", "obl", "punct", "nsubj", "aux", "advmod", "acl:relcl"],
[
"obj",
"flat:name",
"ROOT",
"obl",
"punct",
"nsubj",
"aux",
"advmod",
"acl:relcl",
],
[2, -1, 0, -1, 4, 3, 2, 1, -5],
["New York", "kaupunkina"],
),
@ -130,7 +140,12 @@ FI_NP_TEST_EXAMPLES = [
["NOUN", "VERB", "NOUN", "NOUN", "ADJ", "NOUN"],
["nsubj", "ROOT", "obj", "obl", "amod", "obl"],
[1, 0, -1, -1, 1, -3],
["sairaanhoitopiirit", "leikkaustoimintaa", "alueellaan", "useammassa sairaalassa"],
[
"sairaanhoitopiirit",
"leikkaustoimintaa",
"alueellaan",
"useammassa sairaalassa",
],
),
(
"Lain mukaan varhaiskasvatus on suunnitelmallista toimintaa",