Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,13 +9,13 @@ import nltk
|
|
| 9 |
# Download the required NLTK data
|
| 10 |
nltk.download('punkt')
|
| 11 |
|
|
|
|
| 12 |
# Load the Ubuntu manual from a .txt file
|
| 13 |
try:
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
full_text = file.read()
|
| 17 |
except FileNotFoundError:
|
| 18 |
-
raise FileNotFoundError("The file
|
| 19 |
|
| 20 |
# Function to chunk the text into smaller pieces
|
| 21 |
def chunk_text(text, chunk_size=500): # Larger chunks
|
|
|
|
| 9 |
# Download the required NLTK data
|
| 10 |
nltk.download('punkt')
|
| 11 |
|
| 12 |
+
|
| 13 |
# Load the Ubuntu manual from a .txt file
|
| 14 |
try:
|
| 15 |
+
with open("ubuntu_manual.txt", "r", encoding="utf-8") as file:
|
| 16 |
+
full_text = file.read()
|
|
|
|
| 17 |
except FileNotFoundError:
|
| 18 |
+
raise FileNotFoundError("The file ubuntu_manual.txt was not found.")
|
| 19 |
|
| 20 |
# Function to chunk the text into smaller pieces
|
| 21 |
def chunk_text(text, chunk_size=500): # Larger chunks
|