Skip to content

nguyenhiepvan/vietnamese-related-words

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

    composer require nguyenhiep/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