randomness fix
This commit is contained in:
parent
d0ce4a638f
commit
fb68614f66
|
@ -1,7 +1,7 @@
|
|||
# Instagram Markov Chatbot
|
||||
|
||||
An Instagram chat bot which generates new sentences and sends them in direct messages.
|
||||
Used code from [here](https://towardsdatascience.com/simulating-text-with-markov-chains-in-python-1a27e6d13fc6) as a base.
|
||||
Used code from [here](https://towardsdatascience.com/simulating-text-with-markov-chains-in-python-1a27e6d13fc6) as a base. If the dataset is too small the bot will break.
|
||||
|
||||
## Dependancy
|
||||
- firefox
|
||||
|
@ -27,6 +27,6 @@ Used code from [here](https://towardsdatascience.com/simulating-text-with-markov
|
|||
### Command-line
|
||||
|
||||
- **`headless`**
|
||||
- If you want to run the program headlessly append `MOZ_HEADLESS=1` to the beginning of the command.
|
||||
- If you want to run the program headlessly append `MOZ_HEADLESS=1` to the beginning of the python command.
|
||||
- **`message length`**
|
||||
- Optional argument (integer) that determine the length of the sentence. If no argument is provided or a non integer number was given, messages will generate with variable length between 1 and 30.
|
||||
|
|
8
index.py
8
index.py
|
@ -35,8 +35,8 @@ sleep(5)
|
|||
browser.find_element(By.CSS_SELECTOR, "button.aOOlW:nth-child(2)").click()
|
||||
sleep(5)
|
||||
|
||||
# browser.find_element(
|
||||
# By.XPATH, "/html/body/div[1]/section/div/div[2]/div/div/div[1]/div[2]/div/div/div/div/div[1]/a").click()
|
||||
browser.find_element(
|
||||
By.XPATH, "/html/body/div[1]/section/div/div[2]/div/div/div[1]/div[2]/div/div/div/div/div[1]/a").click()
|
||||
# selects most recent chat ^ chat order
|
||||
|
||||
while True:
|
||||
|
@ -51,9 +51,9 @@ while True:
|
|||
if cmd_length.isdigit():
|
||||
message = markov(int(cmd_length) - 1)
|
||||
else:
|
||||
message = markov(np.random.randint(30))
|
||||
message = markov(randint(30))
|
||||
except IndexError:
|
||||
message = markov(np.random.randint(30))
|
||||
message = markov(randint(30))
|
||||
|
||||
sleep(5)
|
||||
print(message)
|
||||
|
|
Loading…
Reference in a new issue