Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions SentimentAnalysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# File: SentimentAnalysis.py
# Project: Sentiment Analysis using Pretrained Models


from transformers import pipeline

def sentiment_analysis(text):
# Load pretrained model and tokenizer (DistilBERT)
sentiment_model = pipeline("sentiment-analysis")

# Get prediction
result = sentiment_model(text)[0]

# Print and return result
print(f"\n🧠 Input Text: {text}")
print(f"📊 Sentiment: {result['label']} (Confidence: {result['score']:.2f})")

return result

if __name__ == "__main__":
print("=== Sentiment Analysis using Pretrained Models ===")
user_input = input("Enter a sentence or paragraph: ")
sentiment_analysis(user_input)
18 changes: 18 additions & 0 deletions typeconversion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Sno 3 : "Type Conversion and validation examples: Implement a Python program to type conversion and validation examples"

#conversion of tuple to list
tuple=(1,2,3,4,5)
list1=list(tuple)
print("conversion of tuple to list",list1)
#conversion of int to float
a=22
print("conversion of int to float",float(a))
#conversion of float to int
b=33.0
print("conversion of float to int",int(b))
#int to string conversion
c=7888
print("int to string conversion",str(c))
#string len to float
s="swe"
print("string to float",float(len(s)))