---
title: "Discussion on \"Python: Generate Ngrams and Nterms\" | Hashnode"
description: "Discussion on \"Python: Generate Ngrams and Nterms\". [1] Generate Ngrams\nfrom itertools import islice\n\ndef generate_ngrams(text, ngram_size=(2, 2), min_word_size=3, return_tuple=True):\n    \"\"\"\n    Generate strict n-grams (adjacent word sequences) from the input text.\n\n    Args:\n        text (str): The ..."
url: "https://hashnode.com/posts/python-generate-ngrams-and-nterms/67ad3619791d0c209b67465f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Python: Generate Ngrams and Nterms](https://hashnotes.hashnode.dev/python-generate-ngrams-and-nterms?utm_source=hashnode&utm_medium=feed)

\[1\] Generate Ngrams from itertools import islice def generate\_ngrams(text, ngram\_size=(2, 2), min\_word\_size=3, return\_tuple=True): """ Generate strict n-grams (adjacent word sequences) from the input text. Args: text (str): The ...

Feb 13, 2025 · 2 min read · hashnotes.hashnode.dev  
Read the article

-   [#nterm](https://hashnode.com/tag/nterm)
-   [#ngram](https://hashnode.com/tag/ngram)

## Written by

[Mohamad Mahmood](https://hashnode.com/@mohamadrazzimy)

@mohamadrazzimy · Kuala Lumpur, Malaysia

  
[View profile](https://hashnode.com/@mohamadrazzimy)

Programming (Mobile, Web, Database and Machine Learning). Studying at the Center For Artificial Intelligence Technology (CAIT), FTSM, UKM MY

Mohamad's interest is in Programming (Mobile, Web, Database and Machine Learning). He is studying at the Center For Artificial Intelligence Technology (CAIT), Universiti Kebangsaan Malaysia (UKM).

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
