Skip to content

Instantly share code, notes, and snippets.

View dardanxhymshiti's full-sized avatar
🤓
That tall guy who codes!

DardanX dardanxhymshiti

🤓
That tall guy who codes!
View GitHub Profile
Afador, Affenhuahua, Affenpinscher, Afghan Hound, Airedale Terrier, Akbash, Akita, Akita Chow, Akita Pit, Akita Shepherd, Alaskan Klee Kai, Alaskan Malamute, American Bulldog, American English Coonhound, American Eskimo Dog, American Foxhound, American Hairless Terrier, American Leopard Hound, American Pit Bull Terrier, American Pugabull, American Staffordshire Terrier, American Water Spaniel, Anatolian Shepherd Dog, Appenzeller Sennenhunde, Auggie, Aussiedoodle, Aussiepom, Australian Cattle Dog, Australian Kelpie, Australian Retriever, Australian Shepherd, Australian Shepherd Husky, Australian Shepherd Lab Mix, Australian Shepherd Pit Bull Mix, Australian Stumpy Tail Cattle Dog, Australian Terrier, Azawakh, Barbet,
Basenji, Bassador, Basset Fauve de Bretagne, Basset Hound, Basset Retriever, Bavarian Mountain Scent Hound, Beabull, Beagle, Beaglier, Bearded Collie, Bedlington Terrier, Belgian Malinois, Belgian Sheepdog, Belgian Tervuren, Bergamasco Sheepdog, Berger Picard, Bernedoodle, Bernese Mountain Dog, B
Aconite, Ageratum, Allium, Anemone, Angelica, Angelonia, Artemisia, Aster, Astilbe, Aubrieta, Azalea, Balloon Flower, Balsam, Baneberry, Basket of Gold, Bee Balm,
Begonia, Bellflower, Bergenia, Blackeyed Susan, Bleeding Heart, Bloodroot, Boneset, Browallia, Bugleweed, Bugloss, Buttercup, Butterfly Weed, Caladium, Calendula, California Poppy,
Canterbury Bells, Cardinal Flower, Carnation, Castor Bean, Catmint, Celosia, Chives, Chrysanthemum, Clary Sage, Cleome, Coleus, Columbine, Comfrey, Coneflower, Coreopsis,
Corydalis, Cosmos, Crocus, Crown Imperial, Cushion Spurge, Cyclamen, Daffodil, Dahlia, Daisy, Dame’s Rocket, Delphinium, Diascia, Dusty Miller, Dutchman's Breeches, Epimedium,
Evergreen Candytuft , Fennel, Fountain Grass, Foxglove, Gaillardia, Gas Plant, Gaura, Gazania, Geranium, Geum, Globe Thistle, Glory of the Snow, Goatsbeard, Golden Marguerite, Gomphrena,
Heliotrope, Hepatica, Hollyhock, Hosta, Hyacinth, Hyssop, Impatiens, Iris, Jack-in-the-Pulpit, Jacob’s Ladder, Lady's Mantle, Lantana, Lavend
Affogato, Americano, Bicerin, Breve,
Café Bombón, Café au lait, Caffé Corretto,
Café Crema, Caffé Latte, Caffé macchiato,
Café mélange, Coffee milk, Cafe mocha,
Ca phe sua da, Kopi susu, Cappuccino ,
Carajillo, Cortado, Cuban espresso,
Espresso, Eiskaffee, The Flat White,
Frappuccino, Galao, Greek frappé coffee,
Iced Coffee , Kopi Luwak, Kopi Tubruk,
Turkish coffee, Vienna coffee, Yuanyang
Allspice, Angelica, Anise, Asafoetida, Bay Leaf, Basil, Bergamot,
Black Cumin, Black Mustard, Black Pepper, Borage, Brown Mustard, Burnet,
Caraway, Cardamom, Cassia, Catnip, Cayenne Pepper, Celery Seed, Chervil,
Chicory, Chili Pepper, Chives, Cicely, Cilantro, Cinnamon, Clove, Coriander,
Costmary, Cumin, Curry, Dill, Fennel, Fenugreek, Filé, Ginger,
Grains Of Paradise,Holy Basil, Horehound, Horseradish, Hyssop, Lavender,
Lemon Balm, Lemon Grass, Lemon Verbena, Licorice, Lovage, Mace, Marjoram,
Nutmeg, Oregano, Paprika, Parsley, Peppermint, Poppy Seed, Rosemary, Rue,
Saffron, Sage, Savory, Sesame, Sorrel, Star Anise, Spearmint,
Tarragon, Thyme, Turmeric, Vanilla, Wasabi, White Mustard
def get_listed_items_with_colon(text):
import re
list_of_items = []
list_of_sentences = re.split('\.|\?|\!', text)
for sentence in list_of_sentences:
if ':' in sentence:
start_index = sentence.find(':')
sub_sentence = sentence[start_index+1:]
list_of_items.append([word.strip() for word in sub_sentence.split(',')])
return list_of_items
def get_numbers_from_text(text):
import re
pattern = '[-+]?[.]?[\d]+(?:,\d\d\d)*[\.]?\d*(?:[eE][-+]?\d+)?'
list_of_numbers = re.findall(pattern, text)
return list_of_numbers
# Test
text = """A rise in cases was re[prted acrpss a staggering 36 US states last week. In Florida, officals recorded 9,585 new cases on Saturday."""
get_numbers_from_text(text)
def get_text_within_quotes(text):
import re
pattern = "\"(.*?)\""
list_of_findings = re.findall(pattern, text)
return list_of_findings
# Test
text = """The sign said, "Walk". Then it said, "Don't Walk" then, "Walk" all within thirty seconds"""
get_text_within_quotes(text)
def get_capital_words(text):
import re
pattern = r'(\b[A-Z]{2,}\b)'
list_of_capital_words = re.findall(pattern, text)
return list_of_capital_words;
# Test
text = """Thank you! Your customer service request has been logged. A specialist will reach out by EOD"""
get_capital_words(text)
def get_sentences(text):
import re
pattern = r'([A-Z][^\.!?]*[\.!?])'
pattern_compiled = re.compile(pattern, re.M)
list_of_sentences = re.findall(pattern, text)
return list_of_sentences
# Test
text = """This is the most frequent question we're asked by prospective students. And our response? Absolutely! We've trained people from all walks of life."""
def get_context(text, list_of_tokens, context_span=20):
import re
context = []
for token in list_of_tokens:
all_occurences_indices = [m.start() for m in re.finditer(token, text)]
for index in all_occurences_indices:
left_index = max(index - context_span, 0)
right_index = min(index + context_span, len(text))
substring = text[left_index: right_index].strip()