# Add Ngram for Word level instead char level

**URL:** <https://forum.rasa.com/t/add-ngram-for-word-level-instead-char-level/13357>\
**Category:** Rasa Open Source\
**Created:** [July 23, 2019, 5:30am UTC](https://forum.rasa.com/t/add-ngram-for-word-level-instead-char-level/13357 "2019-07-23T05:30:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![narendraprasath](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@narendraprasath](https://forum.rasa.com/u/narendraprasath)\
**Post date:** [July 23, 2019, 5:30am UTC](https://forum.rasa.com/t/add-ngram-for-word-level-instead-char-level/13357/1 "2019-07-23T05:30:13Z")

</div>

Rasa provides Ngram features component by default which able to do character level.

But I am looking for word level N-gram feature extraction.

How can I achieve that? Or Will I need to implement my own component for word level N-gram feature extraction. If yes, The below pipline looks correct or not?

> ```
> - name: "WhitespaceTokenizer"
> - name: "Tri-GramFeature" ## own component #rasa
> - name: "CRFEntityExtractor"  
> - name: "EntitySynonymMapper"
> - name: "CountVectorsFeaturizer"
> - name: "EmbeddingIntentClassifier"
> 
> ```

---

<div class="post-metadata">

**Author:** ![SamS](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sams/32/3497_2.png) [@SamS](https://forum.rasa.com/u/SamS)\
**Post date:** [July 23, 2019, 8:13am UTC](https://forum.rasa.com/t/add-ngram-for-word-level-instead-char-level/13357/2 "2019-07-23T08:13:26Z")

</div>

Hey @narendraprasath, and welcome to the forum!

The `CountVectorsFeaturizer` supports word n-grams as well. Take a look at all the available options [here](https://github.com/RasaHQ/rasa/blob/da045b255968d5b44bfd56e1fec5f1239761ee8d/rasa/nlu/featurizers/count_vectors_featurizer.py#L33). In particular, you can use the (default) `word` analyzer and set your desired n-gram minimum and maximum lengths like this:

```auto
- name: "CountVectorsFeaturizer"
  analyzer: "word"
  min_ngram: 1
  max_ngram: 3

```

Does this answer your question? Also, the upcoming [Rasa summit](https://rasa.com/summit/) is a cool opportunity to meet Rasa contributors, creators and users, and discuss anything Rasa-related 🙂

---

<div class="post-metadata">

**Author:** ![narendraprasath](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@narendraprasath](https://forum.rasa.com/u/narendraprasath)\
**Post date:** [July 23, 2019, 11:47am UTC](https://forum.rasa.com/t/add-ngram-for-word-level-instead-char-level/13357/3 "2019-07-23T11:47:37Z")

</div>

Thanks @SamS

The answer sounds really good. it solves my problem.

---

<div class="post-metadata">

**Author:** ![mmm3bbb](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@mmm3bbb](https://forum.rasa.com/u/mmm3bbb)\
**Post date:** [September 19, 2019, 11:06pm UTC](https://forum.rasa.com/t/add-ngram-for-word-level-instead-char-level/13357/4 "2019-09-19T23:06:39Z")

</div>

Would this work for pre-trained embeddings or just for supervised embeddings.
