mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Tweak line spacing
This commit is contained in:
parent
85603f5b6a
commit
38ed265b7d
|
@ -1,7 +1,7 @@
|
|||
spaCy is commercial open-source software: you can buy a commercial
|
||||
license, or you can use it under the AGPL, as described below.
|
||||
|
||||
spaCy Natural Language Processing Tools
|
||||
spaCy Natural Language Processing Tools
|
||||
Copyright (C) 2015 Matthew Honnibal
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -64,8 +64,6 @@ def clean(ext):
|
|||
if os.path.exists(html):
|
||||
os.unlink(html)
|
||||
|
||||
|
||||
|
||||
HERE = os.path.dirname(__file__)
|
||||
virtual_env = os.environ.get('VIRTUAL_ENV', '')
|
||||
compile_args = []
|
||||
|
|
|
@ -7,6 +7,7 @@ from spacy.lexeme import lex_of
|
|||
|
||||
from spacy import LEX, NORM, SHAPE, LAST3
|
||||
|
||||
|
||||
def test_group_by_lex():
|
||||
tokens = en.tokenize("I like the red one and I like the blue one")
|
||||
names, hashes, groups = tokens.group_by(LEX)
|
||||
|
|
|
@ -40,6 +40,7 @@ def test_begin(state, sentence):
|
|||
assert not state.is_valid('O')
|
||||
assert not state.is_valid('U-PER')
|
||||
|
||||
|
||||
def test_in(state, sentence):
|
||||
state.transition('B-PER')
|
||||
assert state.n_ents == 0
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"""Sphinx doctest is just too hard. Manually paste doctest examples here"""
|
||||
from spacy.en.attrs import IS_LOWER
|
||||
|
||||
|
||||
def test_1():
|
||||
import spacy.en
|
||||
from spacy.parts_of_speech import ADV
|
||||
|
@ -39,6 +40,7 @@ def test2():
|
|||
nlp.vocab[u'quietly'].prob
|
||||
-11.07155704498291
|
||||
|
||||
|
||||
def test3():
|
||||
import spacy.en
|
||||
from spacy.parts_of_speech import ADV
|
||||
|
|
|
@ -8,6 +8,7 @@ from spacy.en import English
|
|||
def EN():
|
||||
return English()
|
||||
|
||||
|
||||
def test_tweebo_challenge(EN):
|
||||
text = u""":o :/ :'( >:o (: :) >.< XD -__- o.O ;D :-) @_@ :P 8D :1 >:( :D =| ") :> ...."""
|
||||
tokens = EN(text)
|
||||
|
|
|
@ -16,6 +16,7 @@ def words():
|
|||
return ["1997", "19.97", "hello9", "Hello", "HELLO", "Hello9", "\n", "!",
|
||||
"!d", "\nd"]
|
||||
|
||||
|
||||
def test_is_alpha(words):
|
||||
assert not is_alpha(words[0])
|
||||
assert not is_alpha(words[1])
|
||||
|
|
|
@ -5,10 +5,12 @@ from spacy.strings import StringStore
|
|||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sstore():
|
||||
return StringStore()
|
||||
|
||||
|
||||
def test_save_bytes(sstore):
|
||||
Hello_i = sstore[b'Hello']
|
||||
assert Hello_i == 1
|
||||
|
|
|
@ -2,10 +2,12 @@ import pytest
|
|||
|
||||
from spacy.en import English
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def EN():
|
||||
return English()
|
||||
|
||||
|
||||
def test_range_iter(EN):
|
||||
for i in range(len(EN.vocab)):
|
||||
lex = EN.vocab[i]
|
||||
|
|
|
@ -17,6 +17,7 @@ def morph_exc():
|
|||
'PRP$': {'his': {'L': '-PRP-', 'person': 3, 'case': 2}},
|
||||
}
|
||||
|
||||
|
||||
def test_load_exc(EN, morph_exc):
|
||||
EN.tagger.load_morph_exceptions(morph_exc)
|
||||
tokens = EN('I like his style.', tag=True)
|
||||
|
|
|
@ -3,6 +3,7 @@ from spacy.en import English
|
|||
|
||||
nlp = English()
|
||||
|
||||
|
||||
def test_simple_types():
|
||||
tokens = nlp(u'Mr. Best flew to New York on Saturday morning.')
|
||||
ents = list(tokens.ents)
|
||||
|
|
|
@ -3,6 +3,7 @@ import pytest
|
|||
|
||||
from spacy.en import English
|
||||
|
||||
|
||||
def test_only_pre1():
|
||||
EN = English()
|
||||
assert len(EN("(")) == 1
|
||||
|
|
|
@ -3,6 +3,7 @@ from spacy.en import English
|
|||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def EN():
|
||||
return English()
|
||||
|
|
|
@ -8,20 +8,26 @@ from spacy.orth import word_shape as ws
|
|||
def test_capitalized():
|
||||
assert ws('Nasa') == 'Xxxx'
|
||||
|
||||
|
||||
def test_truncate():
|
||||
assert ws('capitalized') == 'xxxx'
|
||||
|
||||
|
||||
def test_digits():
|
||||
assert ws('999999999') == 'dddd'
|
||||
|
||||
|
||||
def test_mix():
|
||||
assert ws('C3P0') == 'XdXd'
|
||||
|
||||
|
||||
def test_punct():
|
||||
assert ws(',') == ','
|
||||
|
||||
|
||||
def test_space():
|
||||
assert ws('\n') == '\n'
|
||||
|
||||
|
||||
def test_punct_seq():
|
||||
assert ws('``,-') == '``,-'
|
||||
|
|
|
@ -13,9 +13,11 @@ def EN():
|
|||
def test_no_special(EN):
|
||||
assert len(EN("(can)")) == 3
|
||||
|
||||
|
||||
def test_no_punct(EN):
|
||||
assert len(EN("can't")) == 2
|
||||
|
||||
|
||||
def test_prefix(EN):
|
||||
assert len(EN("(can't")) == 3
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from spacy.en import English
|
||||
import six
|
||||
|
||||
|
||||
def test_tag_names():
|
||||
nlp = English()
|
||||
tokens = nlp(u'I ate pizzas with anchovies.', parse=True, tag=True)
|
||||
|
|
|
@ -6,6 +6,7 @@ import pytest
|
|||
|
||||
NLU = English()
|
||||
|
||||
|
||||
def test_am_pm():
|
||||
numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
|
||||
variants = ['a.m.', 'am', 'p.m.', 'pm']
|
||||
|
|
|
@ -4,6 +4,7 @@ import pytest
|
|||
from spacy.en import English
|
||||
from spacy.parts_of_speech import ADV
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def nlp():
|
||||
return English()
|
||||
|
|
|
@ -7,6 +7,8 @@ from spacy.en.attrs import IS_STOP
|
|||
import pytest
|
||||
|
||||
nlp = English()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def token():
|
||||
tokens = nlp(u'Give it back! He pleaded.')
|
||||
|
|
|
@ -31,6 +31,7 @@ def _orphan_from_list(toks):
|
|||
lst.append(tok)
|
||||
return lst
|
||||
|
||||
|
||||
def test_list_orphans():
|
||||
# Test case from NSchrading
|
||||
nlp = English()
|
||||
|
|
|
@ -10,10 +10,12 @@ from spacy.en import English
|
|||
def EN():
|
||||
return English().tokenizer
|
||||
|
||||
|
||||
def test_no_word(EN):
|
||||
tokens = EN(u'')
|
||||
assert len(tokens) == 0
|
||||
|
||||
|
||||
def test_single_word(EN):
|
||||
tokens = EN(u'hello')
|
||||
assert tokens[0].orth_ == 'hello'
|
||||
|
@ -60,6 +62,7 @@ def test_contraction_punct(EN):
|
|||
tokens = EN("can't!")
|
||||
assert len(tokens) == 3
|
||||
|
||||
|
||||
def test_sample(EN):
|
||||
text = """Tributes pour in for late British Labour Party leader
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ from spacy.en import English
|
|||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tokens():
|
||||
nlp = English()
|
||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
|||
|
||||
from spacy.orth import like_url
|
||||
|
||||
|
||||
def test_basic_url():
|
||||
assert like_url('www.google.com')
|
||||
assert like_url('google.com')
|
||||
|
|
|
@ -4,15 +4,18 @@ from spacy.en import English
|
|||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def EN():
|
||||
return English()
|
||||
|
||||
|
||||
def test_vec(EN):
|
||||
hype = EN.vocab['hype']
|
||||
assert hype.orth_ == 'hype'
|
||||
assert 0.08 >= hype.repvec[0] > 0.07
|
||||
|
||||
|
||||
def test_capitalized(EN):
|
||||
hype = EN.vocab['Hype']
|
||||
assert hype.orth_ == 'Hype'
|
||||
|
|
Loading…
Reference in New Issue
Block a user