Link Search Menu Expand Document Documentation Menu

亚美尼亚语分析器

内置的 armenian 分析器可以使用以下命令应用于文本字段

PUT /arabic-index
{
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "analyzer": "armenian"
      }
    }
  }
}

词干排除

您可以使用以下命令将 stem_exclusion 与此语言分析器一起使用

PUT index_with_stem_exclusion_armenian_analyzer
{
  "settings": {
    "analysis": {
      "analyzer": {
        "stem_exclusion_armenian_analyzer": {
          "type": "armenian",
          "stem_exclusion": ["բարև", "խաղաղություն"] 
        }
      }
    }
  }
}

亚美尼亚语分析器内部结构

armenian 分析器是使用以下组件构建的

  • 分词器:standard

  • 词元过滤器

    • 小写
    • 停用词(亚美尼亚语)
    • 关键词
    • 词干提取器(亚美尼亚语)

自定义亚美尼亚语分析器

您可以使用以下命令创建自定义亚美尼亚语分析器

PUT /armenian-index
{
  "settings": {
    "analysis": {
      "filter": {
        "armenian_stop": {
          "type": "stop",
          "stopwords": "_armenian_"
        },
        "armenian_stemmer": {
          "type": "stemmer",
          "language": "armenian"
        },
        "armenian_keywords": {
          "type":       "keyword_marker",
          "keywords":   [] 
        }
      },
      "analyzer": {
        "armenian_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "armenian_stop",
            "armenian_keywords",
            "armenian_stemmer"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "analyzer": "armenian_analyzer"
      }
    }
  }
}

生成的词元

使用以下请求检查使用该分析器生成的词元

GET armenian-index/_analyze
{
  "analyzer": "stem_exclusion_armenian_analyzer",
  "text": "բարև բոլորին, մենք խաղաղություն ենք ուզում և նոր օր ենք սկսել"
}

响应包含生成的词元

{
  "tokens": [
    {"token": "բարև","start_offset": 0,"end_offset": 4,"type": "<ALPHANUM>","position": 0},
    {"token": "բոլոր","start_offset": 5,"end_offset": 12,"type": "<ALPHANUM>","position": 1},
    {"token": "խաղաղություն","start_offset": 19,"end_offset": 31,"type": "<ALPHANUM>","position": 3},
    {"token": "ուզ","start_offset": 36,"end_offset": 42,"type": "<ALPHANUM>","position": 5},
    {"token": "նոր","start_offset": 45,"end_offset": 48,"type": "<ALPHANUM>","position": 7},
    {"token": "օր","start_offset": 49,"end_offset": 51,"type": "<ALPHANUM>","position": 8},
    {"token": "սկսել","start_offset": 56,"end_offset": 61,"type": "<ALPHANUM>","position": 10}
  ]
}
剩余 350 字符

有问题?

想贡献吗?