Hey guys, some times we received a forwarded message like you will get free recharge or discount coupons if you forward this message to 10 members. But we are not sure weather this message is genuine or not. To determine if a forwarded message is genuine or fake, we need a specific dataset or criteria to evaluate the message’s authenticity. It is a general approach using natural language processing (NLP) techniques. Please note that this approach may not be foolproof and should be customized based on your specific requirements.
The Below is the simple python code to determine the received message is fake or genuine.
To work with below code need to install the python package nltk (Natural language tool kit package).
To install nltk execute the below code in cmd.
C:\Users\DELL>pip install nltk

import nltk
from nltk.sentiment import SentimentIntensityAnalyzer
# Load the NLTK sentiment analyzer
nltk.download('vader_lexicon')
sia = SentimentIntensityAnalyzer()
# Function to determine the authenticity of a forwarded message
def check_message_authenticity(message):
# Preprocess the message (e.g., remove stopwords, punctuation, convert to lowercase, etc.)
# Implement your own preprocessing logic here
# Analyze the sentiment of the message
sentiment_score = sia.polarity_scores(message)
# Define a threshold for sentiment polarity to assess authenticity
threshold = 0.5
# Compare the sentiment score with the threshold
if sentiment_score['compound'] >= threshold:
return "Genuine"
else:
return "Fake"
# Example usage
forwarded_message = "Forward this message to 10 Group your telecom provide gives you 1000 talktime!!! Hurry up i already got"
result = check_message_authenticity(forwarded_message)
print(forwarded_message,"--is",result)
Output of the following is :
==================== RESTART: D:/Python-Code/Fake Mesage.py ====================
[nltk_data] Downloading package vader_lexicon to
[nltk_data] C:\Users\DELL\AppData\Roaming\nltk_data…
[nltk_data] Package vader_lexicon is already up-to-date!
Forward this message to 10 Group your telecom provide gives you 1000 talktime!!! Hurry up i already got is Fake

In this code example, we utilize the Natural Language Toolkit (NLTK) library and its SentimentIntensityAnalyzer
module. Here’s a breakdown of the code:
- We import the necessary modules: nltk for NLP operations and SentimentIntensityAnalyzer for sentiment analysis.
- We download the necessary NLTK resource (vader_lexicon), which is used by the sentiment analyzer.
- We define the is_genuine_message function that takes a message as input and returns whether it is genuine or fake.
- Inside the function, you can implement your own preprocessing logic based on your requirements. This might involve removing stopwords, punctuation, converting to lowercase, and other text normalization techniques.
- We utilize the SentimentIntensityAnalyzer to calculate the sentiment score of the preprocessed message.
- We define a threshold (e.g., 0.5) to determine whether the sentiment polarity indicates a genuine or fake message. You can adjust this threshold based on your evaluation criteria.
- The sentiment score is compared with the threshold, and the function returns “Genuine” if the sentiment score is above or equal to the threshold, and “Fake” otherwise.
- Finally, we provide an example usage by passing a forwarded message to the is_genuine_message function and printing the result.
Keep in mind that this is a simple approach, and depending on your specific needs, you might need to incorporate additional techniques such as keyword analysis, topic modeling, or machine learning algorithms to enhance the accuracy of the classification.
Remember to tailor the code to your specific requirements and modify the preprocessing steps, threshold, or incorporate additional techniques as necessary.
Please note that determining the authenticity of a forwarded message is a challenging task and may require more sophisticated methods, including fact-checking, source verification, and considering multiple perspectives.