Skip to content

Commit 2ce2f81

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 6842a19 according to the output from Autopep8. Details: None
1 parent bb10d94 commit 2ce2f81

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

N-Grams NLP/script.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@
33
import nltk
44
nltk.download('punkt')
55

6+
67
def gen_ngrams(txt, n):
78
tokens = word_tokenize(txt)
89
ngs = list(ngrams(tokens, n))
910
return ngs
1011

12+
1113
def main():
1214
u = input("Enter a sentence: ")
1315
n = int(input("Enter the value of n for n-grams: "))
14-
16+
1517
ngs = gen_ngrams(u, n)
16-
18+
1719
print(f"Input Sentence: {u}")
1820
print(f"{n}-grams: {ngs}")
1921

22+
2023
if __name__ == "__main__":
2124
main()

0 commit comments

Comments
 (0)