Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,24 @@
|
|
|
|
1 |
from ginger import correct_sentence
|
2 |
|
3 |
def main():
|
4 |
"""
|
5 |
Main application function.
|
6 |
-
|
7 |
"""
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
# Display the original and corrected sentences
|
21 |
-
print(f"Original Sentence: {text}")
|
22 |
-
print(f"Corrected Sentence: {corrected_text}\n")
|
23 |
|
24 |
if __name__ == "__main__":
|
25 |
main()
|
|
|
1 |
+
import sys
|
2 |
from ginger import correct_sentence
|
3 |
|
4 |
def main():
|
5 |
"""
|
6 |
Main application function.
|
7 |
+
Accepts input via command-line arguments and corrects grammar using the Ginger API.
|
8 |
"""
|
9 |
+
if len(sys.argv) < 2:
|
10 |
+
print("Please provide a sentence as an argument.")
|
11 |
+
sys.exit(1)
|
12 |
|
13 |
+
# Combine all command-line arguments into one sentence
|
14 |
+
text = ' '.join(sys.argv[1:])
|
15 |
+
|
16 |
+
# Correct the sentence using the Ginger API
|
17 |
+
corrected_text = correct_sentence(text)
|
18 |
|
19 |
+
# Display the original and corrected sentences
|
20 |
+
print(f"Original Sentence: {text}")
|
21 |
+
print(f"Corrected Sentence: {corrected_text}")
|
|
|
|
|
|
|
22 |
|
23 |
if __name__ == "__main__":
|
24 |
main()
|