-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/LyubomirT/lesp
- Loading branch information
Showing
5 changed files
with
247 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version = 1 | ||
|
||
exclude_patterns = [ | ||
"config", | ||
"demo_config", | ||
".gitignore", | ||
"LICENSE", | ||
"README.md", | ||
"CONTRIBUTING.md", | ||
"small_wordlist.txt", | ||
"wordlist.txt" | ||
] | ||
|
||
[[analyzers]] | ||
name = "python" | ||
|
||
[analyzers.meta] | ||
runtime_version = "3.x.x" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#from lesp import is_correct | ||
from lesp.autocorrect import is_correct, get_similar | ||
import random | ||
|
||
# Load words from wordlist file | ||
with open("wordlist.txt", "r") as f: | ||
words = [word.strip() for word in f.readlines()] | ||
random_word = random.choice(words) | ||
|
||
# Create a word with blanks | ||
word_with_blanks = "" | ||
for i, letter in enumerate(random_word): | ||
if i % 2 == 0: | ||
word_with_blanks += letter | ||
else: | ||
word_with_blanks += "_" | ||
|
||
print("Fill in the blanks:", word_with_blanks) | ||
|
||
# User input | ||
user_input = input("Your guess: ") | ||
|
||
# Check spelling | ||
if user_input.lower() == random_word: | ||
print("Correct!") | ||
else: | ||
print(f"Incorrect. The correct word is '{random_word}'.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#from lesp import is_correct | ||
from lesp.autocorrect import is_correct, get_similar | ||
import random | ||
|
||
# Load words from wordlist file | ||
with open("wordlist.txt", "r") as f: | ||
words = [word.strip() for word in f.readlines()] | ||
|
||
# Pick a random word and scramble it | ||
word = random.choice(words) | ||
scrambled = ''.join(random.sample(word, len(word))) | ||
print("Unscramble this word:", scrambled) | ||
|
||
# User guesses | ||
guess = input("Your guess: ") | ||
|
||
# Check if guess is correct | ||
if guess.lower() == word: | ||
print("Correct!") | ||
else: | ||
print(f"Incorrect. The correct word was '{word}'.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters