This commit is contained in:
Matthew Honnibal 2017-03-16 17:40:07 -05:00
commit 859315863a
3 changed files with 18 additions and 0 deletions

4
.gitignore vendored
View File

@ -105,3 +105,7 @@ website/package.json
website/announcement.jade
website/www/
website/.gitignore
# Python virtualenv
venv
venv/*

View File

@ -31,6 +31,12 @@ def test_spans_root(doc):
assert span.root.text == 'sentence'
assert span.root.head.text == 'is'
def test_spans_string_fn(doc):
span = doc[0:4]
assert len(span) == 4
assert span.text == 'This is a sentence'
assert span.upper_ == 'THIS IS A SENTENCE'
assert span.lower_ == 'this is a sentence'
def test_spans_root2(en_tokenizer):
text = "through North and South Carolina"

View File

@ -365,6 +365,14 @@ cdef class Span:
def __get__(self):
return ' '.join([t.lemma_ for t in self]).strip()
property upper_:
def __get__(self):
return ''.join([t.string.upper() for t in self]).strip()
property lower_:
def __get__(self):
return ''.join([t.string.lower() for t in self]).strip()
property string:
def __get__(self):
return ''.join([t.string for t in self])