You can download this code by clicking the button below.
This code is now available for download.
This function is used to detect the language type of a text. It takes a string argument and returns the language code of the text.
Technology Stack : TextBlob
Code Type : Function
Code Difficulty : Intermediate
def detect_language(text):
from textblob import TextBlob
blob = TextBlob(text)
language = blob.detect_language()
return language