spaCy - Token.check_flag 方法
此方法用于检查布尔标志的值。
参数
下表解释了其参数 −
NAME | TYPE | DESCRIPTION |
---|---|---|
flag_id | Int | 它表示要检查的标志的属性 ID。 |
示例 1
Token.check_flag 方法的示例如下所示 −
import spacy nlp_model = spacy.load("en_core_web_sm") from spacy.attrs import IS_TITLE doc = nlp_model("This is TutorialsPoint.com.") token = doc[0] token.check_flag(IS_TITLE)
输出
输出如下 −
True
示例 2
下面给出了 Token.check_flag 方法的另一个示例 −
token = doc[1] token.check_flag(IS_TITLE)
输出
False
spacy_container_token_class.html