toanld/vietnamese-related-words

Make related words from vietnamese string

v1.0.2 2023-10-05 01:36 UTC

This package is auto-updated.

Last update: 2024-05-05 02:59:32 UTC


README

    composer require toanld/vietnamese-related-words

Configuration

To configure the package you need to publish settings first:

    php artisan vendor:publish --provider="Nguyenhiep\VietnameseRelatedWords\VietnameseRelatedWordsServiceProvider"
Option Description
es_host elasticsearch host
mapping additional mapping rules

Usage

    $analyer = new Nguyenhiep\VietnameseRelatedWords\VietnameseAnalyzer();
    //using vncorenlp
    $analyer->vncorenlp("một chuỗi tiếng việt"); //["chuỗi tiếng","một chuỗi","chuỗi tiếng việt",]
    //using coccoc tokenizer
    $analyer->es_analyze("một chuỗi tiếng việt"); //["một","chuỗi","tiếng việt",]
    //using  VnTokenizer library
    $analyer->es_analyze("một chuỗi tiếng việt"); //["một","chuỗi","tiếng","việt",]

Notice:

- if you want to see analying results, add param `true` to analyer construct

- if you want to add more mapping rules, add them in `vietnamese-related-words.php`

Reference