Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

非ASCII字符会被直接忽略 #994

Open
sissilab opened this issue Jan 13, 2023 · 0 comments
Open

非ASCII字符会被直接忽略 #994

sissilab opened this issue Jan 13, 2023 · 0 comments

Comments

@sissilab
Copy link

使用 ik 分词会直接忽略掉非ASCII字符,如下例子:açaí à,请问这种情况如何处理?

GET _analyze
{
  "analyzer": "ik_max_word",
  "text": "açaí à la carte"
}

{
  "tokens": [
    {
      "token": "la",
      "start_offset": 7,
      "end_offset": 9,
      "type": "ENGLISH",
      "position": 0
    },
    {
      "token": "carte",
      "start_offset": 10,
      "end_offset": 15,
      "type": "ENGLISH",
      "position": 1
    }
  ]
}

此为 asciifolding filter过滤情况,能转换为ASCII字符:

GET /_analyze
{
  "tokenizer" : "standard",
  "filter" : ["asciifolding"],
  "text" : "açaí à la carte"
}

{
  "tokens": [
    {
      "token": "acai",
      "start_offset": 0,
      "end_offset": 4,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "a",
      "start_offset": 5,
      "end_offset": 6,
      "type": "<ALPHANUM>",
      "position": 1
    },
    {
      "token": "la",
      "start_offset": 7,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 2
    },
    {
      "token": "carte",
      "start_offset": 10,
      "end_offset": 15,
      "type": "<ALPHANUM>",
      "position": 3
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant