Created
January 1, 2023 10:45
-
-
Save CodeMaster7000/8a77a0cfa3d0fa2ed30c2ac8e04a3ab9 to your computer and use it in GitHub Desktop.
A handy language detector coded in Python. It's time for you to put it to the test!
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
from tkinter import * | |
from langdetect import * | |
from iso639 import languages | |
root = Tk() | |
root.title("Language Detector") | |
root.geometry("400x480") | |
def language_detection(): | |
text = T.get("1.0", 'end-1c') | |
language_code = languages.get(alpha2=detect(text)) | |
l_d.config(text="Language Detected: "+language_code.name) | |
T = Text(root) | |
T.pack() | |
l_d = Label(root, text="Language Detected: ") | |
l_d.pack(pady=10) | |
Button(root, text='Detect Language', command=language_detection).pack(pady=10) | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment