COTOHA APIで形態素解析
COTOHA
https://api.ce-cotoha.com/contents/?utm_source=google&utm_medium=cpc&utm_campaign=cotoha-api_001_ac_g&waad=y49i2kVx
(1)登録
(2)サンプル取得cotoha_api_python3.py
(3)情報設定
・config.iniに設定
・cotoha_api_python3.pyに文を設定
(4)実行
$ python cotoha_api_python3.py
-------------
{
"result": [
{
"chunk_info": {
"id": 0,
"head": 1,
"dep": "D",
"chunk_head": 2,
"chunk_func": 2,
"links": []
},
"tokens": [
{
"id": 0,
"form": "第",
"kana": "ダイ",
"lemma": "第",
"pos": "冠数詞",
"features": [],
"attributes": {}
},
{
"id": 1,
"form": "九十",
"kana": "キュージュー",
"lemma": "九十",
"pos": "Number",
"features": [],
"attributes": {}
},
{
"id": 2,
"form": "条",
"kana": "ジョウ",
"lemma": "条",
"pos": "助数詞",
"features": [],
"dependency_labels": [
{
"token_id": 1,
"label": "compound"
},
{
"token_id": 0,
"label": "dep"
},
{
"token_id": 3,
"label": "punct"
}
],
"attributes": {}
},
{
"id": 3,
"form": " ",
"kana": "",
"lemma": " ",
"pos": "空白",
"features": [],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 1,
"head": 2,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 0,
"label": "other"
}
]
},
"tokens": [
{
"id": 4,
"form": "公",
"kana": "オオヤケ",
"lemma": "公",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 2,
"label": "nmod"
},
{
"token_id": 5,
"label": "case"
}
],
"attributes": {}
},
{
"id": 5,
"form": "の",
"kana": "ノ",
"lemma": "の",
"pos": "格助詞",
"features": [
"連体"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 2,
"head": 4,
"dep": "D",
"chunk_head": 1,
"chunk_func": 1,
"links": [
{
"link": 1,
"label": "adjectivals"
}
]
},
"tokens": [
{
"id": 6,
"form": "秩序",
"kana": "チツジョ",
"lemma": "秩序",
"pos": "名詞",
"features": [],
"attributes": {}
},
{
"id": 7,
"form": "又は",
"kana": "マタハ",
"lemma": "又は",
"pos": "連体詞",
"features": [],
"dependency_labels": [
{
"token_id": 4,
"label": "nmod"
},
{
"token_id": 6,
"label": "amod"
}
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 3,
"head": 4,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": []
},
"tokens": [
{
"id": 8,
"form": "善良",
"kana": "ゼンリョウ",
"lemma": "善良",
"pos": "名詞",
"features": [
"形容"
],
"dependency_labels": [
{
"token_id": 9,
"label": "case"
}
],
"attributes": {}
},
{
"id": 9,
"form": "の",
"kana": "ノ",
"lemma": "の",
"pos": "格助詞",
"features": [
"連体"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 4,
"head": 5,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 2,
"label": "adjectivals"
},
{
"link": 3,
"label": "adjectivals"
}
]
},
"tokens": [
{
"id": 10,
"form": "風俗",
"kana": "フウゾク",
"lemma": "風俗",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 7,
"label": "amod"
},
{
"token_id": 8,
"label": "amod"
},
{
"token_id": 11,
"label": "case"
}
],
"attributes": {}
},
{
"id": 11,
"form": "に",
"kana": "ニ",
"lemma": "に",
"pos": "格助詞",
"features": [
"連用"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 5,
"head": 6,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 4,
"label": "object"
}
],
"predicate": []
},
"tokens": [
{
"id": 12,
"form": "反",
"kana": "ハン",
"lemma": "反する",
"pos": "動詞語幹",
"features": [
"SX"
],
"dependency_labels": [
{
"token_id": 10,
"label": "dobj"
},
{
"token_id": 13,
"label": "aux"
}
],
"attributes": {}
},
{
"id": 13,
"form": "する",
"kana": "スル",
"lemma": "する",
"pos": "動詞接尾辞",
"features": [
"連体"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 6,
"head": 8,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 5,
"label": "adjectivals"
}
]
},
"tokens": [
{
"id": 14,
"form": "事項",
"kana": "ジコウ",
"lemma": "事項",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 12,
"label": "acl"
},
{
"token_id": 15,
"label": "case"
}
],
"attributes": {}
},
{
"id": 15,
"form": "を",
"kana": "ヲ",
"lemma": "を",
"pos": "格助詞",
"features": [
"連用"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 7,
"head": 8,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": []
},
"tokens": [
{
"id": 16,
"form": "目的",
"kana": "モクテキ",
"lemma": "目的",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 17,
"label": "cop"
}
],
"attributes": {}
},
{
"id": 17,
"form": "と",
"kana": "ト",
"lemma": "と",
"pos": "判定詞",
"features": [
"連用"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 8,
"head": 9,
"dep": "D",
"chunk_head": 0,
"chunk_func": 0,
"links": [
{
"link": 6,
"label": "object"
},
{
"link": 7,
"label": "coagent"
}
],
"predicate": []
},
"tokens": [
{
"id": 18,
"form": "する",
"kana": "スル",
"lemma": "する",
"pos": "動詞語幹",
"features": [
"SURU"
],
"dependency_labels": [
{
"token_id": 14,
"label": "dobj"
},
{
"token_id": 16,
"label": "nmod"
}
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 9,
"head": 11,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 8,
"label": "other"
}
]
},
"tokens": [
{
"id": 19,
"form": "法律行為",
"kana": "ホウリツコウイ",
"lemma": "法律行為",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 18,
"label": "amod"
},
{
"token_id": 20,
"label": "case"
},
{
"token_id": 21,
"label": "punct"
}
],
"attributes": {}
},
{
"id": 20,
"form": "は",
"kana": "ハ",
"lemma": "は",
"pos": "連用助詞",
"features": [],
"attributes": {}
},
{
"id": 21,
"form": "、",
"kana": "",
"lemma": "、",
"pos": "読点",
"features": [],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 10,
"head": 11,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [],
"predicate": []
},
"tokens": [
{
"id": 22,
"form": "無効",
"kana": "ムコウ",
"lemma": "無効",
"pos": "名詞",
"features": [
"形容"
],
"dependency_labels": [
{
"token_id": 23,
"label": "cop"
}
],
"attributes": {}
},
{
"id": 23,
"form": "と",
"kana": "ト",
"lemma": "と",
"pos": "判定詞",
"features": [
"連用"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 11,
"head": -1,
"dep": "O",
"chunk_head": 0,
"chunk_func": 0,
"links": [
{
"link": 9,
"label": "object"
},
{
"link": 10,
"label": "coagent"
}
],
"predicate": []
},
"tokens": [
{
"id": 24,
"form": "する",
"kana": "スル",
"lemma": "する",
"pos": "動詞語幹",
"features": [
"SURU"
],
"dependency_labels": [
{
"token_id": 19,
"label": "dobj"
},
{
"token_id": 22,
"label": "nmod"
},
{
"token_id": 25,
"label": "punct"
}
],
"attributes": {}
},
{
"id": 25,
"form": "。",
"kana": "",
"lemma": "。",
"pos": "句点",
"features": [],
"attributes": {}
}
]
}
],
"status": 0,
"message": ""
}
real 0m5.322s
user 0m0.092s
sys 0m0.039s
-------------
https://api.ce-cotoha.com/contents/?utm_source=google&utm_medium=cpc&utm_campaign=cotoha-api_001_ac_g&waad=y49i2kVx
(1)登録
(2)サンプル取得cotoha_api_python3.py
(3)情報設定
・config.iniに設定
・cotoha_api_python3.pyに文を設定
(4)実行
$ python cotoha_api_python3.py
-------------
{
"result": [
{
"chunk_info": {
"id": 0,
"head": 1,
"dep": "D",
"chunk_head": 2,
"chunk_func": 2,
"links": []
},
"tokens": [
{
"id": 0,
"form": "第",
"kana": "ダイ",
"lemma": "第",
"pos": "冠数詞",
"features": [],
"attributes": {}
},
{
"id": 1,
"form": "九十",
"kana": "キュージュー",
"lemma": "九十",
"pos": "Number",
"features": [],
"attributes": {}
},
{
"id": 2,
"form": "条",
"kana": "ジョウ",
"lemma": "条",
"pos": "助数詞",
"features": [],
"dependency_labels": [
{
"token_id": 1,
"label": "compound"
},
{
"token_id": 0,
"label": "dep"
},
{
"token_id": 3,
"label": "punct"
}
],
"attributes": {}
},
{
"id": 3,
"form": " ",
"kana": "",
"lemma": " ",
"pos": "空白",
"features": [],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 1,
"head": 2,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 0,
"label": "other"
}
]
},
"tokens": [
{
"id": 4,
"form": "公",
"kana": "オオヤケ",
"lemma": "公",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 2,
"label": "nmod"
},
{
"token_id": 5,
"label": "case"
}
],
"attributes": {}
},
{
"id": 5,
"form": "の",
"kana": "ノ",
"lemma": "の",
"pos": "格助詞",
"features": [
"連体"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 2,
"head": 4,
"dep": "D",
"chunk_head": 1,
"chunk_func": 1,
"links": [
{
"link": 1,
"label": "adjectivals"
}
]
},
"tokens": [
{
"id": 6,
"form": "秩序",
"kana": "チツジョ",
"lemma": "秩序",
"pos": "名詞",
"features": [],
"attributes": {}
},
{
"id": 7,
"form": "又は",
"kana": "マタハ",
"lemma": "又は",
"pos": "連体詞",
"features": [],
"dependency_labels": [
{
"token_id": 4,
"label": "nmod"
},
{
"token_id": 6,
"label": "amod"
}
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 3,
"head": 4,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": []
},
"tokens": [
{
"id": 8,
"form": "善良",
"kana": "ゼンリョウ",
"lemma": "善良",
"pos": "名詞",
"features": [
"形容"
],
"dependency_labels": [
{
"token_id": 9,
"label": "case"
}
],
"attributes": {}
},
{
"id": 9,
"form": "の",
"kana": "ノ",
"lemma": "の",
"pos": "格助詞",
"features": [
"連体"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 4,
"head": 5,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 2,
"label": "adjectivals"
},
{
"link": 3,
"label": "adjectivals"
}
]
},
"tokens": [
{
"id": 10,
"form": "風俗",
"kana": "フウゾク",
"lemma": "風俗",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 7,
"label": "amod"
},
{
"token_id": 8,
"label": "amod"
},
{
"token_id": 11,
"label": "case"
}
],
"attributes": {}
},
{
"id": 11,
"form": "に",
"kana": "ニ",
"lemma": "に",
"pos": "格助詞",
"features": [
"連用"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 5,
"head": 6,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 4,
"label": "object"
}
],
"predicate": []
},
"tokens": [
{
"id": 12,
"form": "反",
"kana": "ハン",
"lemma": "反する",
"pos": "動詞語幹",
"features": [
"SX"
],
"dependency_labels": [
{
"token_id": 10,
"label": "dobj"
},
{
"token_id": 13,
"label": "aux"
}
],
"attributes": {}
},
{
"id": 13,
"form": "する",
"kana": "スル",
"lemma": "する",
"pos": "動詞接尾辞",
"features": [
"連体"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 6,
"head": 8,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 5,
"label": "adjectivals"
}
]
},
"tokens": [
{
"id": 14,
"form": "事項",
"kana": "ジコウ",
"lemma": "事項",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 12,
"label": "acl"
},
{
"token_id": 15,
"label": "case"
}
],
"attributes": {}
},
{
"id": 15,
"form": "を",
"kana": "ヲ",
"lemma": "を",
"pos": "格助詞",
"features": [
"連用"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 7,
"head": 8,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": []
},
"tokens": [
{
"id": 16,
"form": "目的",
"kana": "モクテキ",
"lemma": "目的",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 17,
"label": "cop"
}
],
"attributes": {}
},
{
"id": 17,
"form": "と",
"kana": "ト",
"lemma": "と",
"pos": "判定詞",
"features": [
"連用"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 8,
"head": 9,
"dep": "D",
"chunk_head": 0,
"chunk_func": 0,
"links": [
{
"link": 6,
"label": "object"
},
{
"link": 7,
"label": "coagent"
}
],
"predicate": []
},
"tokens": [
{
"id": 18,
"form": "する",
"kana": "スル",
"lemma": "する",
"pos": "動詞語幹",
"features": [
"SURU"
],
"dependency_labels": [
{
"token_id": 14,
"label": "dobj"
},
{
"token_id": 16,
"label": "nmod"
}
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 9,
"head": 11,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [
{
"link": 8,
"label": "other"
}
]
},
"tokens": [
{
"id": 19,
"form": "法律行為",
"kana": "ホウリツコウイ",
"lemma": "法律行為",
"pos": "名詞",
"features": [],
"dependency_labels": [
{
"token_id": 18,
"label": "amod"
},
{
"token_id": 20,
"label": "case"
},
{
"token_id": 21,
"label": "punct"
}
],
"attributes": {}
},
{
"id": 20,
"form": "は",
"kana": "ハ",
"lemma": "は",
"pos": "連用助詞",
"features": [],
"attributes": {}
},
{
"id": 21,
"form": "、",
"kana": "",
"lemma": "、",
"pos": "読点",
"features": [],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 10,
"head": 11,
"dep": "D",
"chunk_head": 0,
"chunk_func": 1,
"links": [],
"predicate": []
},
"tokens": [
{
"id": 22,
"form": "無効",
"kana": "ムコウ",
"lemma": "無効",
"pos": "名詞",
"features": [
"形容"
],
"dependency_labels": [
{
"token_id": 23,
"label": "cop"
}
],
"attributes": {}
},
{
"id": 23,
"form": "と",
"kana": "ト",
"lemma": "と",
"pos": "判定詞",
"features": [
"連用"
],
"attributes": {}
}
]
},
{
"chunk_info": {
"id": 11,
"head": -1,
"dep": "O",
"chunk_head": 0,
"chunk_func": 0,
"links": [
{
"link": 9,
"label": "object"
},
{
"link": 10,
"label": "coagent"
}
],
"predicate": []
},
"tokens": [
{
"id": 24,
"form": "する",
"kana": "スル",
"lemma": "する",
"pos": "動詞語幹",
"features": [
"SURU"
],
"dependency_labels": [
{
"token_id": 19,
"label": "dobj"
},
{
"token_id": 22,
"label": "nmod"
},
{
"token_id": 25,
"label": "punct"
}
],
"attributes": {}
},
{
"id": 25,
"form": "。",
"kana": "",
"lemma": "。",
"pos": "句点",
"features": [],
"attributes": {}
}
]
}
],
"status": 0,
"message": ""
}
real 0m5.322s
user 0m0.092s
sys 0m0.039s
-------------
コメント