Skip to content

Instantly share code, notes, and snippets.

@binhqd
Created May 3, 2019 07:30
Show Gist options
  • Save binhqd/6e7dfbe5fa56ff72fea6dde35348f497 to your computer and use it in GitHub Desktop.
Save binhqd/6e7dfbe5fa56ff72fea6dde35348f497 to your computer and use it in GitHub Desktop.
Mercury Phrase classification
{
"settings": {
"index": {
"analysis": {
"analyzer" : {
"akt_analyzer_pattern_en" : {
"tokenizer" : "akt_pattern_tokernizer_en",
"filter" : [
"synonym_en",
"spell_en_US",
"lowercase",
"asciifolding",
"trim"
]
},
"akt_potential_type": {
"tokenizer" : "akt_potential_type",
"filter" : [
"lowercase",
"spell_en_US",
"asciifolding",
"trim"
]
},
"akt_text_without_type": {
"tokenizer" : "akt_text_without_type",
"filter" : [
"stop",
"lowercase",
"spell_en_US",
"asciifolding",
"trim"
]
}
},
"tokenizer": {
"akt_pattern_tokernizer_en": {
"type": "pattern",
"pattern": "(hotel|hostel|astotel|motel|restaurant|bar|museum|cafe|café|coffee|bakery|baker|pizzeria|pizza|^bake|bake$|cake|cuisine|food|bridge|stadium|moutain|beach|park|chocolat|salon|kitchen|boutique|resort|villa|bakery|cathedral|church|bank|airport|garden|spa$|^spa|^opera|opera$|station|studio|dessert|cuisine|cook|grill|steak| |,|-|_|&)"
},
"akt_potential_type": {
"type": "pattern",
"pattern": "(hotel[s]?|restaurant|bar|museum|cafe)",
"flags": "CASE_INSENSITIVE",
"group": 1
},
"akt_text_without_type": {
"type": "pattern",
"pattern": "(hotel[s]?|restaurant|bar|museum|cafe| |,|-|_|&)",
"flags": "CASE_INSENSITIVE"
}
},
"filter" : {
"synonym_en" : {
"type" : "synonym",
"synonyms_path" : "analysis/en_synonyms.txt"
},
"spell_en_US": {
"type": "hunspell",
"language": "en_US"
}
}
}
}
},
"mappings": {
"_doc": {
"properties": {
"object": {
"type": "text",
"analyzer": "akt_analyzer_pattern_en",
"fields": {
"name_without_type": {
"type": "text",
"analyzer": "akt_text_without_type",
"fielddata": true,
"fields": {
"length": {
"type": "token_count",
"analyzer": "akt_text_without_type"
}
}
},
"potential_type": {
"type": "text",
"analyzer": "akt_potential_type",
"fielddata": true
}
}
},
"type": {
"type": "text"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment