Skip to content

Instantly share code, notes, and snippets.

View kshirsagarsiddharth's full-sized avatar
🎯
Focusing

kshirsagarsiddharth

🎯
Focusing
View GitHub Profile

Comparison of Ollama, Hugging Face Platform, and OpenAI API

Feature Ollama Hugging Face Platform OpenAI API
Execution Local execution on user machines Cloud-based and local execution options Cloud-based execution on remote servers
Privacy & Security Data remains on the user's device, enhancing privacy and security Data can be processed locally or on remote servers Robust security measures to protect user data during API interactions
Compatibility Supports most open-source LLMs, experimental compatibility with OpenAI Supports a wide range of models, datasets, and applications Access to advanced models like GPT-4
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Login email;Identifier;First name;Last name
[email protected];2070;Laura;Grey
[email protected];4081;Craig;Johnson
[email protected];9346;Mary;Jenkins
[email protected];5079;Jamie;Smith
import spacy
# Load the English model
nlp = spacy.load("en_core_web_sm")
def clean_social_media_data(text):
# Process the text
doc = nlp(text)
# Extract the lemmas and remove stop words
import re
def clean_social_media_data(text):
# Remove hashtags and mentions
text = re.sub(r'#\w+', '', text)
text = re.sub(r'@\w+', '', text)
# Remove emojis
text = re.sub(r'[^\x00-\x7F]+', '', text)
import spacy
# Load the English model
nlp = spacy.load("en_core_web_sm")
def lemmatize_text(text):
# Process the text
doc = nlp(text)
# Extract the lemmas
import nltk
from nltk.stem import WordNetLemmatizer
# Initialize the lemmatizer
lemmatizer = WordNetLemmatizer()
def lemmatize_text(text):
# Tokenize the text
tokens = nltk.word_tokenize(text)
import nltk
from nltk.corpus import stopwords
# Load the stop words
stop_words = set(stopwords.words('english'))
def remove_stop_words(text):
# Tokenize the text
tokens = nltk.word_tokenize(text)
def remove_stop_words(text):
# Split the text into words
words = text.split()
# Define the stop words
stop_words = ['a', 'an', 'and', 'the', 'in', 'of']
# Remove stop words
clean_words = [word for word in words if word not in stop_words]
import re
def clean_text(text):
# Use a regular expression to remove punctuation and special characters
clean_text = re.sub(r'[^\w\s]', '', text)
# Remove leading and trailing whitespace
clean_text = clean_text.strip()
return clean_text
import string
def clean_text(text):
# Create a translation table to remove punctuation and special characters we are replacing space.
translator = str.maketrans('', '', string.punctuation + string.printable.replace(' ','')[62:])
# Use the translate method to remove the characters
clean_text = text.translate(translator)