Skip to content

Commit

Permalink
Merge pull request #14 from accraze/custom-state-size
Browse files Browse the repository at this point in the history
Allow custom hidden state size
  • Loading branch information
accraze authored Jul 29, 2018
2 parents 8228dd6 + 60e35b3 commit c318621
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ia_markov/markov.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ class MarkovModel(object):
on an Internet Archive text file.
"""

def __init__(self, exclude=None):
def __init__(self, exclude=None, state_size=2):
self.archive_name = None
self.exclude = exclude
self.model = None
self.state_size = state_size

def train_model(self, archive_name):
"""
Expand Down Expand Up @@ -78,7 +79,7 @@ def _create_markov(self, text):
Assign markovify.Text
as model
"""
self.model = markovify.Text(text)
self.model = markovify.Text(text, state_size=self.state_size)


class POSMarkov(MarkovModel):
Expand All @@ -88,7 +89,7 @@ def _create_markov(self, text):
Assign part of speech tagged markov
to model.
"""
self.model = POSifiedText(text)
self.model = POSifiedText(text, state_size=self.state_size)


class POSifiedText(markovify.Text):
Expand Down

0 comments on commit c318621

Please sign in to comment.