๐Ÿ•ธ๏ธ
Deep Learning
  • ๐Ÿ’ซDeep Learning Notes
  • ๐Ÿ’ผPractical Tools
  • ๐Ÿ’ŽConcepts of Neural Networks
    • ๐ŸŒฑIntroduction
    • ๐Ÿ”ŽThe Problem in General
    • ๐Ÿ‘ทโ€โ™€๏ธ Implementation Notes
    • ๐Ÿ“šCommon Concepts
    • ๐Ÿ’ฅActivation Functions
    • ๐ŸŽˆPractical Aspects
    • ๐Ÿ‘ฉโ€๐Ÿ”ง NN Regularization
    • โœจOptimization Algorithms
    • ๐ŸŽจSoftmax Regression
    • ๐Ÿƒโ€โ™€๏ธ Introduction to Tensorflow
    • ๐Ÿ‘ฉโ€๐Ÿ’ป Python Code Snippets
  • ๐Ÿ™‹โ€โ™€๏ธ Hello World of Deep Learning with Neural Networks
    • ๐ŸŒฑIntroduction
    • ๐ŸŒCNNs In Browser
  • ๐ŸšชIntroduction to Computer Vision
    • ๐ŸŒฑIntroduction
  • ๐ŸšฉConcepts of Convolutional Neural Networks
    • ๐ŸŒฑIntroduction
    • ๐Ÿ“ŒCommon Concepts
    • ๐ŸŒŸAdvanced Concepts
    • ๐Ÿ‘€Visualization
    • ๐Ÿ‘ตClassic Networks
    • โœจOther Approaches
    • ๐Ÿ•ธ๏ธCommon Applications
  • ๐Ÿ‘ฉโ€๐Ÿ’ป Works and Notes on CNNs
    • ๐ŸŒฑIntroduction
  • ๐Ÿ’„Popular Strategies of Deep Learning
    • ๐ŸŒฑIntroduction
    • ๐Ÿš™Transfer Learning
    • ๐Ÿ“šOther Strategies
  • ๐ŸคกImage Augmentation
    • ๐ŸŒฑIntroduction
  • ๐Ÿคธโ€โ™€๏ธ Notes on Applied Machine Learning
    • ๐ŸŒฑIntroduction
    • ๐Ÿ‘ฉโ€๐Ÿ”ง Notes on Structuring Machine Learning Projects
    • ๐Ÿ‘ฉโ€๐Ÿซ Implementation Guidelines
  • ๐Ÿ•ต๏ธโ€โ™€๏ธ Basics of Object Detection
    • ๐ŸŒฑIntroduction
    • โญ•Region-Based CNNs
    • ๐ŸคณSSD and YOLO
    • ๐Ÿค–TensorFlow Object Detection API
    • ๐ŸžModel Debugging
  • โžฐSequence Models In Deep Learning
    • ๐ŸŒฑIntroduction
    • ๐Ÿ“šGeneral Concepts
    • ๐Ÿ”„Recurrent Neural Networks
    • ๐ŸŒŒVanishing Gradients with RNNs
    • ๐ŸŒšWord Representation
    • ๐Ÿ’ฌMixed Info On NLP
  • ๐Ÿ’ฌNLP
    • ๐ŸŒฑIntroduction
  • ๐Ÿ’ฌApplied NLP
    • ๐Ÿ™Œ๐Ÿป Handling texts
    • ๐ŸงฉRegex
  • ๐Ÿ‘€Quick Visual Info
  • ๐Ÿ“šPDFs that I found and recommend
Powered by GitBook
On this page
  • ๐Ÿ“• Notebooks
  • ๐Ÿ’  Python built-in functions
  • ๐Ÿ“ Length of a string
  • ๐ŸŽ’ Words properties
  • ๐Ÿฅ Upper and lower
  • ๐Ÿ•ต๏ธโ€โ™€๏ธ Unique Words
  • ๐Ÿ‘ฎโ€โ™€๏ธ Checking Ops
  • ๐Ÿ”ค String Ops
  • ๐Ÿงต Split & Join

Was this helpful?

Export as PDF
  1. Applied NLP

๐Ÿ™Œ๐Ÿป Handling texts

Handling texts using Python's built-in functions

PreviousApplied NLPNextRegex

Last updated 4 years ago

Was this helpful?

๐Ÿ“• Notebooks

๐Ÿ’  Python built-in functions

๐Ÿ“ Length of a string

๐Ÿ”ข Number of characters

text = "Beauty always reserved in details, don't let the big picture steal your attention!"
len(text)
# 82

๐Ÿงพ Number of words

text = "Beauty always reserved in details, don't let the big picture steal your attention!"
words = text.split(' ')
len(words)
# 13

4๏ธโƒฃ Getting words have length greater than 4

text = "Beauty always reserved in details, don't let the big picture steal your attention!"
words = text.split(' ')
moreThan4 = [w for w in words if len(w) > 4]
# ['Beauty', 'always', 'reserved', 'details,', "don't", 'picture', 'steal', 'attention!']

๐ŸŽ’ Words properties

๐Ÿ”  Getting capitalized words

text = "Beauty Always reserved in details, Don't let the big picture steal your attention!"
words = text.split(' ')
capitalized = [w for w in words if w.istitle()]
# ['Beauty', 'Always']
# "Don't" is not found ๐Ÿ™„

๐Ÿ”š Getting words end with specific end

  • or specific start .startswith()

text = "You can hide whatever you want to hide but your eyes will always expose you, eyes never lie."
words = text.split(' ')
endsWithEr = [w for w in words if w.endswith('er')]
# ['whatever', 'never']

๐Ÿฅ Upper and lower

"ESMA".isupper() # True
"Esma".isupper() # False
"esma".isupper() # False

"esma".islower() # True
"ESMA".islower() # False
"Esma".islower() # False

๐Ÿคต Membership test

'm' in 'esma' # True
'es' in 'esma' # True
'ed' in 'esma' # False

๐Ÿ•ต๏ธโ€โ™€๏ธ Unique Words

๐Ÿ” Case sensitive

text = "To be or not to be"
words = text.split(' ')
unique = set(words)
# {'be', 'To', 'not', 'or', 'to'}

โœ–๏ธ ๐Ÿ” Ignore case

text = "To be or not to be"
words = text.split(' ')
unique = set(w.lower() for w in words)
# {'not', 'or', 'be', 'to'}

๐Ÿ‘ฎโ€โ™€๏ธ Checking Ops

Is Digit?

'17'.isdigit() # True
'17.7'.isdigit() # False

Is Alphabetic?

'esma'.isalpha() # True
'esma17'.isalpha() # False

Is alphabetic or number?

'17esma'.isalnum() # True
'17esma;'.isalnum() # False

๐Ÿ”ค String Ops

"Esma".lower() # esma
"Esma".upper() # ESMA
"EsmA".title() # Esma

๐Ÿงต Split & Join

Split due to specific character

text = "Beauty,Always,reserved,in,details,Don't,let,the,big,picture,steal,your,attention!"
words = text.split(',')
# ['Beauty', 'Always', 'reserved', 'in', 'details', "Don't", 'let', 'the', 'big', 'picture', 'steal', 'your', 'attention!']

Join by specific character

text = "Beauty,Always,reserved,in,details,Don't,let,the,big,picture,steal,your,attention!"
words = text.split(',')
joined = " ".join(words)
# Beauty Always reserved in details Don't let the big picture steal your attention!
๐Ÿ’ฌ
๐Ÿ’  Python built-in functions
๐Ÿผ String Processing with Pandas