Snowball 词元过滤器

编辑

一个使用 Snowball 生成的词干分析器来词干化单词的过滤器。language 参数控制词干分析器,可用值如下:Arabic, Armenian, Basque, Catalan, Danish, Dutch, English, Estonian, Finnish, French, German, German2, Hungarian, Italian, Irish, Kp, Lithuanian, Lovins, Norwegian, Porter, Portuguese, Romanian, Russian, Serbian, Spanish, Swedish, Turkish

[8.16.0] 在 8.16.0 中已弃用。未来版本将移除 KpLovins 的支持

例如

resp = client.indices.create(
    index="my-index-000001",
    settings={
        "analysis": {
            "analyzer": {
                "my_analyzer": {
                    "tokenizer": "standard",
                    "filter": [
                        "lowercase",
                        "my_snow"
                    ]
                }
            },
            "filter": {
                "my_snow": {
                    "type": "snowball",
                    "language": "English"
                }
            }
        }
    },
)
print(resp)
const response = await client.indices.create({
  index: "my-index-000001",
  settings: {
    analysis: {
      analyzer: {
        my_analyzer: {
          tokenizer: "standard",
          filter: ["lowercase", "my_snow"],
        },
      },
      filter: {
        my_snow: {
          type: "snowball",
          language: "English",
        },
      },
    },
  },
});
console.log(response);
PUT /my-index-000001
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "tokenizer": "standard",
          "filter": [ "lowercase", "my_snow" ]
        }
      },
      "filter": {
        "my_snow": {
          "type": "snowball",
          "language": "English"
        }
      }
    }
  }
}