7.6.9. geo-disjoint オプション

GeoDisjointFilter を作成し、 geonlp.parse および geonlp.parseStructured の結果に対して このフィルタを適用します。

パラメータで指定された GeoJSON が表す領域に含まれない地名語 以外は地名語ではない固有名詞に置き換えられます。

パラメータ

geo-disjoint : str, dict

  • str の場合、まず GeoJSON 文字列として解釈します。 JSON 文字列では無い場合は GeoJSON を返す URL と解釈し、 HTTP で問い合わせを行ないます。

  • dict の場合、 GeoJSON をデコードしたオブジェクトと 解釈します。 FeatureCollection, Feature, および geometry に対応します。

7.6.9.1. リクエストの例

東京周辺を含むポリゴンを空間領域として指定し、 その領域に含まれない地名語だけを抽出します。 「府中」は京都府の府中駅に解決されます。

{
  "method": "geonlp.parse",
  "params": {
    "sentence": "府中に行きます。",
    "options": {
      "geo-disjoint": "https://geoshape.ex.nii.ac.jp/city/geojson/20230101/13/13206A1968.geojson"
    }
  },
  "id": "test_parse_geo_disjoint"
}

7.6.9.2. レスポンスの例

{
  "features": [
    {
      "geometry": {
        "coordinates": [
          134.48298,
          34.074285
        ],
        "type": "Point"
      },
      "properties": {
        "geoword_properties": {
          "body": "府中",
          "dictionary_id": 3,
          "dictionary_identifier": "geonlp:ksj-station-N02",
          "entry_id": "7yxN4G",
          "geolod_id": "Qi4qUj",
          "hypernym": [
            "四国旅客鉄道",
            "徳島線"
          ],
          "institution_type": "JR在来線",
          "latitude": "34.074285",
          "longitude": "134.48298",
          "ne_class": "鉄道施設/鉄道駅",
          "railway_class": "普通鉄道JR",
          "suffix": [
            "駅",
            ""
          ]
        },
        "morphemes": {
          "conjugated_form": "",
          "conjugation_type": "*",
          "original_form": "府中",
          "pos": "名詞",
          "prononciation": "",
          "subclass1": "固有名詞",
          "subclass2": "地名語",
          "subclass3": "Qi4qUj:府中駅",
          "surface": "府中",
          "yomi": ""
        },
        "node_type": "GEOWORD",
        "surface": "府中"
      },
      "type": "Feature"
    },
    {
      "geometry": null,
      "properties": {
        "morphemes": {
          "conjugated_form": "*",
          "conjugation_type": "*",
          "original_form": "に",
          "pos": "助詞",
          "prononciation": "ニ",
          "subclass1": "格助詞",
          "subclass2": "一般",
          "subclass3": "*",
          "surface": "に",
          "yomi": "ニ"
        },
        "node_type": "NORMAL",
        "surface": "に"
      },
      "type": "Feature"
    },
    {
      "geometry": null,
      "properties": {
        "morphemes": {
          "conjugated_form": "五段・カ行促音便",
          "conjugation_type": "連用形",
          "original_form": "行く",
          "pos": "動詞",
          "prononciation": "イキ",
          "subclass1": "自立",
          "subclass2": "*",
          "subclass3": "*",
          "surface": "行き",
          "yomi": "イキ"
        },
        "node_type": "NORMAL",
        "surface": "行き"
      },
      "type": "Feature"
    },
    {
      "geometry": null,
      "properties": {
        "morphemes": {
          "conjugated_form": "特殊・マス",
          "conjugation_type": "基本形",
          "original_form": "ます",
          "pos": "助動詞",
          "prononciation": "マス",
          "subclass1": "*",
          "subclass2": "*",
          "subclass3": "*",
          "surface": "ます",
          "yomi": "マス"
        },
        "node_type": "NORMAL",
        "surface": "ます"
      },
      "type": "Feature"
    },
    {
      "geometry": null,
      "properties": {
        "morphemes": {
          "conjugated_form": "*",
          "conjugation_type": "*",
          "original_form": "。",
          "pos": "記号",
          "prononciation": "。",
          "subclass1": "句点",
          "subclass2": "*",
          "subclass3": "*",
          "surface": "。",
          "yomi": "。"
        },
        "node_type": "NORMAL",
        "surface": "。"
      },
      "type": "Feature"
    }
  ],
  "type": "FeatureCollection"
}