Irish analyzer

The built-in irish analyzer can be applied to a text field using the following command:

  1. PUT /irish-index
  2. {
  3. "mappings": {
  4. "properties": {
  5. "content": {
  6. "type": "text",
  7. "analyzer": "irish"
  8. }
  9. }
  10. }
  11. }

copy

Stem exclusion

You can use stem_exclusion with this language analyzer using the following command:

  1. PUT index_with_stem_exclusion_irish_analyzer
  2. {
  3. "settings": {
  4. "analysis": {
  5. "analyzer": {
  6. "stem_exclusion_irish_analyzer": {
  7. "type": "irish",
  8. "stem_exclusion": ["údarás", "faomhadh"]
  9. }
  10. }
  11. }
  12. }
  13. }

copy

Irish analyzer internals

The irish analyzer is built using the following components:

  • Tokenizer: standard

  • Token filters:

    • hyphenation (Irish)
    • elision (Irish)
    • lowercase (Irish)
    • stop (Irish)
    • keyword
    • stemmer (Irish)

Custom Irish analyzer

You can create a custom Irish analyzer using the following command:

  1. PUT /irish-index
  2. {
  3. "settings": {
  4. "analysis": {
  5. "filter": {
  6. "irish_stop": {
  7. "type": "stop",
  8. "stopwords": "_irish_"
  9. },
  10. "irish_elision": {
  11. "type": "elision",
  12. "articles": [ "d", "m", "b" ],
  13. "articles_case": true
  14. },
  15. "irish_hyphenation": {
  16. "type": "stop",
  17. "stopwords": [ "h", "n", "t" ],
  18. "ignore_case": true
  19. },
  20. "irish_lowercase": {
  21. "type": "lowercase",
  22. "language": "irish"
  23. },
  24. "irish_stemmer": {
  25. "type": "stemmer",
  26. "language": "irish"
  27. },
  28. "irish_keywords": {
  29. "type": "keyword_marker",
  30. "keywords": []
  31. }
  32. },
  33. "analyzer": {
  34. "irish_analyzer": {
  35. "type": "custom",
  36. "tokenizer": "standard",
  37. "filter": [
  38. "irish_hyphenation",
  39. "irish_elision",
  40. "irish_lowercase",
  41. "irish_stop",
  42. "irish_keywords",
  43. "irish_stemmer"
  44. ]
  45. }
  46. }
  47. }
  48. },
  49. "mappings": {
  50. "properties": {
  51. "content": {
  52. "type": "text",
  53. "analyzer": "irish_analyzer"
  54. }
  55. }
  56. }
  57. }

copy

Generated tokens

Use the following request to examine the tokens generated using the analyzer:

  1. POST /irish-index/_analyze
  2. {
  3. "field": "content",
  4. "text": "Tá mic léinn ag staidéar in ollscoileanna na hÉireann. Is iad a gcuid uimhreacha ná 123456."
  5. }

copy

The response contains the generated tokens:

  1. {
  2. "tokens": [
  3. {"token": "tá","start_offset": 0,"end_offset": 2,"type": "<ALPHANUM>","position": 0},
  4. {"token": "mic","start_offset": 3,"end_offset": 6,"type": "<ALPHANUM>","position": 1},
  5. {"token": "léinn","start_offset": 7,"end_offset": 12,"type": "<ALPHANUM>","position": 2},
  6. {"token": "staidéar","start_offset": 16,"end_offset": 24,"type": "<ALPHANUM>","position": 4},
  7. {"token": "ollscoileanna","start_offset": 28,"end_offset": 41,"type": "<ALPHANUM>","position": 6},
  8. {"token": "héireann","start_offset": 45,"end_offset": 53,"type": "<ALPHANUM>","position": 8},
  9. {"token": "cuid","start_offset": 64,"end_offset": 69,"type": "<ALPHANUM>","position": 12},
  10. {"token": "uimhreacha","start_offset": 70,"end_offset": 80,"type": "<ALPHANUM>","position": 13},
  11. {"token": "123456","start_offset": 84,"end_offset": 90,"type": "<NUM>","position": 15}
  12. ]
  13. }