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

Settings sample for filter stopwords #8

Closed
buithehien1991 opened this issue Oct 14, 2015 · 4 comments
Closed

Settings sample for filter stopwords #8

buithehien1991 opened this issue Oct 14, 2015 · 4 comments

Comments

@buithehien1991
Copy link

I've just written settings but I'm not sure about that.

analysis: {
               analyzer: {
                   email: {
                       tokenizer: 'keyword',
                       filter: ['lowercase']
                   },
                   vietnamese: {
                       tokenizer: 'vi_analyzer',
                       filter: ['lowercase', 'vi_stop']
                   }
               }
           } 

Could you correct me with I was wrong?

@buithehien1991
Copy link
Author

I've seen on https://github.com/duydo/elasticsearch-analysis-vietnamese/blob/master/src/main/java/org/apache/lucene/analysis/vi/VietnameseAnalyzer.java

final List<String> stopWords = Arrays.asList(
                "bị", "bởi", "cả", "các", "cái", "cần", "càng", "chỉ", "chiếc", "cho", "chứ", "chưa", "chuyện",
                "có", "có thể", "cứ", "của", "cùng", "cũng", "đã", "đang", "đây", "để", "đến nỗi", "đều", "điều",
                "do", "đó", "được", "dưới", "gì", "khi", "không", "là", "lại", "lên", "lúc", "mà", "mỗi", "một cách",
                "này", "nên", "nếu", "ngay", "nhiều", "như", "nhưng", "những", "nơi", "nữa", "phải", "qua", "ra",
                "rằng", "rằng", "rất", "rất", "rồi", "sau", "sẽ", "so", "sự", "tại", "theo", "thì", "trên", "trước",
                "từ", "từng", "và", "vẫn", "vào", "vậy", "vì", "việc", "với", "vừa"
        );

So, how to use it? on setting of filter.
Thank you so much....

@buithehien1991
Copy link
Author

Addition, I'm working on Rails project and use Chewy gem using elasticsearch as wrapper, So I think setting of it like as setting for elasticsearch.
You can see here: https://github.com/toptal/chewy

Thank you so much for your help.

@duydo
Copy link
Owner

duydo commented Oct 15, 2015

@buithehien1991 You don't need to define a custom Vietnamese analyzer, you can use vi_analyzer directly in mapping:

"properties: {
    "text": { "type": "string", "analyzer": "vi_analyzer"}
}

In case you want to define a custom Vietnamese analyzer to apply other filters as you mentioned in the first question, you can use vi_tonkenizer:

"analysis": {
    "analyzer": {
        "custom_vi": {
              "tokenizer": "vi_tokenizer",
              "filter": ["lowercase", "stop",...]
        } 
    }
}

@duydo
Copy link
Owner

duydo commented Dec 16, 2015

Closed due to lack of feedback.

@duydo duydo closed this as completed Dec 16, 2015
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

2 participants