From d953bba4be82f51b6fa9c592dad083f6955202a4 Mon Sep 17 00:00:00 2001 From: RojerGS Date: Sat, 25 Mar 2017 16:29:51 +0000 Subject: [PATCH 1/2] Fixed bug with for loop Limit of the foor loop was missing the last ngram of the text. --- text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text.py b/text.py index 991c764d9..ec23d813e 100644 --- a/text.py +++ b/text.py @@ -60,7 +60,7 @@ def add_sequence(self, words): n = self.n words = self.add_empty(words, n) - for i in range(len(words) - n): + for i in range(len(words) - n + 1): self.add(tuple(words[i:i + n])) def samples(self, nwords): From a59f37f566e017edb934332ee1347258c688e8fd Mon Sep 17 00:00:00 2001 From: RojerGS Date: Sat, 25 Mar 2017 16:40:16 +0000 Subject: [PATCH 2/2] Fixed minor flake8 error Flake8 was complaining about too much whitespace after a return keyword; fixed that --- text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text.py b/text.py index ec23d813e..27c6a9406 100644 --- a/text.py +++ b/text.py @@ -80,7 +80,7 @@ def samples(self, nwords): class NgramCharModel(NgramTextModel): def add_empty(self, words, n): - return ' ' * (n - 1) + words + return ' ' * (n - 1) + words def add_sequence(self, words): for word in words: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy