emoticons

How to properly print a list of unicode characters in python?

寵の児 提交于 2020-08-07 05:21:09
问题 I am trying to search for emoticons in python strings. So I have, for example, em_test = ['\U0001f680'] print(em_test) ['🚀'] test = 'This is a test string 💰💰🚀' if any(x in test for x in em_test): print ("yes, the emoticon is there") else: print ("no, the emoticon is not there") yes, the emoticon is there and if a search em_test in 'This is a test string 💰💰🚀' I can actually find it. So I have made a csv file with all the emoticons I want defined by their unicode. The CSV looks like this:

How to properly print a list of unicode characters in python?

隐身守侯 提交于 2020-08-07 05:19:47
问题 I am trying to search for emoticons in python strings. So I have, for example, em_test = ['\U0001f680'] print(em_test) ['🚀'] test = 'This is a test string 💰💰🚀' if any(x in test for x in em_test): print ("yes, the emoticon is there") else: print ("no, the emoticon is not there") yes, the emoticon is there and if a search em_test in 'This is a test string 💰💰🚀' I can actually find it. So I have made a csv file with all the emoticons I want defined by their unicode. The CSV looks like this:

Regex to match text with only emoticons and no other text

女生的网名这么多〃 提交于 2020-03-05 03:25:27
问题 I have this regex for detecting if a string contains any emoticons: /(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|[\ud83c[\ude50\ude3a]|\ud83c[\ude50-\ude51]|

Python regex: find words and emoticons

梦想的初衷 提交于 2020-01-07 08:07:23
问题 I want to find matches between a tweet and a list of strings containing words, phrases, and emoticons. Here is my code: words = [':)','and i','sleeping','... :)','! <3','facebook'] regex = re.compile(r'\b%s\b|(:\(|:\))+' % '\\b|\\b'.join(words), flags=re.IGNORECASE) I keep receiving this error: error: unbalanced parenthesis Apparently there is something wrong with the code and it cannot match emoticons. Any idea how to fix it? 回答1: The re module has a function escape that takes care of

Segoe UI Symbol smiley is sometimes colorful, sometimes not

谁都会走 提交于 2020-01-07 04:51:48
问题 I have the following problem with my smileys: <!-- Displays a colorful smiley --> <PivotItem Header="Add 😶" FontFamily="Segoe UI Symbol"> <!-- Displays a black & white smiley --> <TextBlock Text="😶" FontFamily="Segoe UI Symbol"/> How do I get a nice colorful smiley in a TextBlock? Is it a particularity of the TextBlock? Should I use another component to display this text... and if so, which one? Thanks! Edit1: the top (yellow and white) smiley is the one of the pivot item, the red and

Segoe UI Symbol smiley is sometimes colorful, sometimes not

本小妞迷上赌 提交于 2020-01-07 04:51:07
问题 I have the following problem with my smileys: <!-- Displays a colorful smiley --> <PivotItem Header="Add 😶" FontFamily="Segoe UI Symbol"> <!-- Displays a black & white smiley --> <TextBlock Text="😶" FontFamily="Segoe UI Symbol"/> How do I get a nice colorful smiley in a TextBlock? Is it a particularity of the TextBlock? Should I use another component to display this text... and if so, which one? Thanks! Edit1: the top (yellow and white) smiley is the one of the pivot item, the red and

Border fail to size to Textblock

左心房为你撑大大i 提交于 2020-01-05 08:56:10
问题 In an attempt to go around the problem described in this other question: Segoe UI Symbol smiley is sometimes colorful, sometimes not (WP8.1 + XAML), I tried the following: wrapping my Textblock with a Border element with rounded-corners (high CornerRadius ). This way I can change the background color of the border and it looks pretty much as if the smiley had a background color itself... almost. There is still a small gotcha I cannot wrap my head around: the height of the TextBlock seems to

Single PHP Function To Replace Text With Emoticons Or Filter Words

纵然是瞬间 提交于 2020-01-04 14:06:15
问题 So I'm trying to find a way to build a function that will replace text with an image if it's an emoticon or with a filtered word if it is a prohibited word. I've taken a look at this code: $smiles = array( 'xD' => 'devil.png', '>:)' => 'devil.png', 'x(' => 'angry.png', ':((' => 'cry.png', ':*' => 'kiss.png', ':))' => 'laugh.png', ':D' => 'laugh.png', ':-D' => 'laugh.png', ':x' => 'love.png', '(:|' => 'sleepy.png', ':)' => 'smile.png', ':-)' => 'smile.png', ':(' => 'sad.png', ':-(' => 'sad.png

Single PHP Function To Replace Text With Emoticons Or Filter Words

左心房为你撑大大i 提交于 2020-01-04 14:02:08
问题 So I'm trying to find a way to build a function that will replace text with an image if it's an emoticon or with a filtered word if it is a prohibited word. I've taken a look at this code: $smiles = array( 'xD' => 'devil.png', '>:)' => 'devil.png', 'x(' => 'angry.png', ':((' => 'cry.png', ':*' => 'kiss.png', ':))' => 'laugh.png', ':D' => 'laugh.png', ':-D' => 'laugh.png', ':x' => 'love.png', '(:|' => 'sleepy.png', ':)' => 'smile.png', ':-)' => 'smile.png', ':(' => 'sad.png', ':-(' => 'sad.png

Single PHP Function To Replace Text With Emoticons Or Filter Words

时光毁灭记忆、已成空白 提交于 2020-01-04 14:01:59
问题 So I'm trying to find a way to build a function that will replace text with an image if it's an emoticon or with a filtered word if it is a prohibited word. I've taken a look at this code: $smiles = array( 'xD' => 'devil.png', '>:)' => 'devil.png', 'x(' => 'angry.png', ':((' => 'cry.png', ':*' => 'kiss.png', ':))' => 'laugh.png', ':D' => 'laugh.png', ':-D' => 'laugh.png', ':x' => 'love.png', '(:|' => 'sleepy.png', ':)' => 'smile.png', ':-)' => 'smile.png', ':(' => 'sad.png', ':-(' => 'sad.png