本文整理匯總了Python中spacy.tokens.Doc.is_parsed方法的典型用法代碼示例。如果您正苦於以下問題:Python Doc.is_parsed方法的具體用法?Python Doc.is_parsed怎麽用?Python Doc.is_parsed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類spacy.tokens.Doc
的用法示例。
在下文中一共展示了Doc.is_parsed方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_issue599
# 需要導入模塊: from spacy.tokens import Doc [as 別名]
# 或者: from spacy.tokens.Doc import is_parsed [as 別名]
def test_issue599(en_vocab):
doc = Doc(en_vocab)
doc.is_tagged = True
doc.is_parsed = True
doc2 = Doc(doc.vocab)
doc2.from_bytes(doc.to_bytes())
assert doc2.is_parsed
示例2: test_issue1834
# 需要導入模塊: from spacy.tokens import Doc [as 別名]
# 或者: from spacy.tokens.Doc import is_parsed [as 別名]
def test_issue1834():
"""Test that sentence boundaries & parse/tag flags are not lost
during serialization."""
string = "This is a first sentence . And another one"
doc = Doc(Vocab(), words=string.split())
doc[6].sent_start = True
new_doc = Doc(doc.vocab).from_bytes(doc.to_bytes())
assert new_doc[6].sent_start
assert not new_doc.is_parsed
assert not new_doc.is_tagged
doc.is_parsed = True
doc.is_tagged = True
new_doc = Doc(doc.vocab).from_bytes(doc.to_bytes())
assert new_doc.is_parsed
assert new_doc.is_tagged
示例3: doc_not_parsed
# 需要導入模塊: from spacy.tokens import Doc [as 別名]
# 或者: from spacy.tokens.Doc import is_parsed [as 別名]
def doc_not_parsed(en_tokenizer):
text = "This is a sentence. This is another sentence. And a third."
tokens = en_tokenizer(text)
doc = Doc(tokens.vocab, words=[t.text for t in tokens])
doc.is_parsed = False
return doc