# Trouble SmartCN analyzer

**URL:** <https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328>\
**Category:** Elasticsearch\
**Created:** [October 6, 2016, 4:29am UTC](https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328 "2016-10-06T04:29:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![minhnhat2807](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/minhnhat2807/32/12311_2.png) [@minhnhat2807](https://discuss.elastic.co/u/minhnhat2807)\
**Post date:** [October 6, 2016, 4:29am UTC](https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328/1 "2016-10-06T04:29:35Z")

</div>

Hi all,

curl -XGET '[http://localhost:9200/mm-chs/\_analyze?analyzer=smartcn](http://localhost:9200/mm-chs/_analyze?analyzer=smartcn)' -d 'curator post'  
{"tokens":[{"token":"curat","start\_offset":0,"end\_offset":7,"type":"word","position":0},{"token":"post","start\_offset":8,"end\_offset":12,"type":"word","position":1}]}

Anyone can explain why it curat and post? maybe it's end with OR so ... condition

Thanks.

---

<div class="post-metadata">

**Author:** ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)\
**Post date:** [October 6, 2016, 8:10am UTC](https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328/2 "2016-10-06T08:10:38Z")

</div>

> [@minhnhat2807](#):
>
> curl -XGET '[http://localhost:9200/mm-chs/\_analyze?analyzer=smartcn](http://localhost:9200/mm-chs/_analyze?analyzer=smartcn)' -d 'curator post'

Smartcn Analyzer is composed of `HMMChineseTokenizer ` and `PorterStemFilter`.  
See : [https://github.com/apache/lucene-solr/blob/branch\_5\_5/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java#L144](https://github.com/apache/lucene-solr/blob/branch_5_5/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java#L144)

Then, [Porter stem token filter](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-porterstem-tokenfilter.html) stem the word.  
If you don't need this feature, you should use `smartcn_tokenizer ` instead.

---

<div class="post-metadata">

**Author:** ![minhnhat2807](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/minhnhat2807/32/12311_2.png) [@minhnhat2807](https://discuss.elastic.co/u/minhnhat2807)\
**Post date:** [October 7, 2016, 2:41am UTC](https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328/3 "2016-10-07T02:41:52Z")

</div>

@johtani thanks for your reply

Could you please explain more details about HMMChineseTokenizer  
Example: "curator post" should analyze 2 tokens "curator" and "post"

this setting is ok?  
var indexSettings = {  
"settings": {  
"analysis": {  
"analyzer": {  
"default": {  
"type": "smartcn",  
"tokenizer": "smartcn\_tokenizer",  
}  
}  
}  
}  
};

Thanks

---

<div class="post-metadata">

**Author:** ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)\
**Post date:** [October 7, 2016, 3:30am UTC](https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328/4 "2016-10-07T03:30:37Z")

</div>

See how to set up custom analyzer : [https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html)

You should replace `type` value to `custom`.

```auto
{
  "settings": {
    "analysis": {
      "analyzer": {
        "default" : {
          "type": "custom",
          "tokenizer": "smartcn_tokenizer"
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![minhnhat2807](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/minhnhat2807/32/12311_2.png) [@minhnhat2807](https://discuss.elastic.co/u/minhnhat2807)\
**Post date:** [October 7, 2016, 10:13am UTC](https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328/5 "2016-10-07T10:13:07Z")

</div>

@johtani thanks a lot, let me try

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:14pm UTC](https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328/6 "2017-07-05T22:14:05Z")

</div>


