<jupyter_start><jupyter_text>Cluster same word structure based on POS and Entities<jupyter_code>bahdanau_entities = malaya.entity.deep_model('bahdanau')
bahdanau_pos = malaya.pos.deep_model('bahdanau')
result_entities = bahdanau_entities.predict(string)
result_pos = bahdanau_pos.predict(string)
from malaya.cluster import cluster_words, pos_entities_ngram
generated_grams = pos_entities_ngram(
    result_pos,
    result_entities,
    ngram = (1, 3),
    accept_pos = ['NOUN', 'PROPN', 'VERB'],
    accept_entities = ['law', 'location', 'organization', 'person', 'time'],
)
generated_grams
cluster_words(generated_grams)<jupyter_output><empty_output><jupyter_text>Cluster POS and Entities<jupyter_code>from malaya.cluster import cluster_pos, cluster_entities
cluster_pos(result_pos)
cluster_entities(result_entities)<jupyter_output><empty_output><jupyter_text>Generate ngrams<jupyter_code>from malaya.cluster import sentence_ngram
sentence_ngram(string, ngram = (3, 5))<jupyter_output><empty_output>