Tag modules¶
Tag module¶
- class pyknp.knp.tag.Tag(spec, tag_id=0, juman_format=0)[source]¶
Bases:
object
ある文に関する基本句列を保持するオブジェクト
- Parameters
spec (str) – KNP出力
tag_id (int) – 基本句ID
juman_format (JUMAN_FORMAT) – Jumanのlattice出力形式
- tag_id¶
基本句ID
- Type
int
- midasi¶
見出し
- Type
str
- parent_id¶
親の基本句ID
- Type
int
- children¶
子の基本句オブジェクトのリスト
- Type
list
- dpndtype¶
係り受けタイプ
- Type
str
- fstring¶
feature情報
- Type
str
- repname¶
正規化代表表記 (normalized_repnameに同じ)
- Type
str
- normalized_repname¶
正規化代表表記
- Type
str
- head_repname¶
主辞代表表記
- Type
str
- head_prime_repname¶
主辞’代表表記
- Type
str
- pred_repname¶
用言代表表記
- Type
str
- disambiguated_pred_repname¶
標準用言代表表記
- Type
str
PAS module¶
- class pyknp.knp.pas.Pas(tid=None, result=None)[source]¶
Bases:
object
述語項構造を扱うクラス
- Usage:
result = knp.result(knp_result) pas = result.tag_list()[tid].pas # tid番目の基本句(述語)の項構造
- cfid¶
格フレームID (例: “行う/おこなう:動10”)
- Type
str
- arguments¶
格と項を対応付けた辞書 {case: [Argument, ..]} keyは格を表す文字列, valueはArgumentオブジェクトのリスト。 リスト形式なのは、ガ格などは複数の項を取り得るため。
- Type
dict of (case, list of Argument)
- __init__(tid=None, result=None)[source]¶
Initialize self. See help(type(self)) for accurate signature.
- get_arguments(case)[source]¶
指定した格の各項ごとに代表表記の配列を返す
- Usage:
result = knp.parse(“研究者になる”) print(result.tag_list()[2].midasi) >> なる print(result.tag_list()[2].pas.get_arguments(“ニ”)) >> [ArgRepname(repname=’者/しゃ’, tid_list=1)]
- Parameters
case (str) – 格の文字列
- Returns
項の代表表記を格納したnamedtupleである ArgRepname のリスト
- Return type
list
- class pyknp.knp.pas.Argument(sid=None, tid=None, eid=None, midasi='', flag=None, sdist=None)[source]¶
Bases:
object
項に関する情報を保持するオブジェクト
詳しくは下記ページの「格要素側」の記述方法を参照 http://nlp.ist.i.kyoto-u.ac.jp/index.php?KNP%2F%E6%A0%BC%E8%A7%A3%E6%9E%90%E7%B5%90%E6%9E%9C%E6%9B%B8%E5%BC%8F
- sid¶
文ID
- Type
str
- tid¶
基本句ID
- Type
int
- eid¶
Entity ID
- Type
int
- midasi¶
表記
- Type
str
- flag¶
フラグ (C, N, O, D, E, U)
- Type
str
- sdist¶
述語の何文前か
- Type
int
Feature module¶
- class pyknp.knp.features.Features(spec, splitter='><', ignore_first_character=True)[source]¶
Bases:
dict
feature情報を保持するオブジェクト
feature情報に含まれるタグをパースし、辞書形式にする。 ex. “<正規化代表表記:遅れる/おくれる>” –> {“正規化代表表記”: “遅れる/おくれる”}
- __init__(spec, splitter='><', ignore_first_character=True)[source]¶
Initialize self. See help(type(self)) for accurate signature.
- property pas¶