-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update regex matching for cjk characters
Regex matching is not kind to non-Latin character sets. Instead of using word boundaries (\b) for the end of hashtags, I've changed to a lookahead assertion checking for a space or the end of a line. I'm going to verify what characters are allowed by twitter in a hashtag and adjust this lookahead accordingly, in case other characters can break a hashtag.
- Loading branch information
Showing
4 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import {Tweet} from 'src/models' | ||
|
||
export const koreanTweet: Tweet = { | ||
data: { | ||
id: '1564281755531722755', | ||
created_at: '2022-08-29T16:00:08.000Z', | ||
text: 'A Minji a day keeps the bad vibes away~\n\nPlaying with our money \n\n#JiU #지유 #Dreamcatcher #드림캐쳐 https://t.co/IRpqINac5X', | ||
attachments: { | ||
media_keys: ['3_1564281751844884482'], | ||
}, | ||
conversation_id: '1564281755531722755', | ||
entities: { | ||
hashtags: [ | ||
{ | ||
start: 66, | ||
end: 70, | ||
tag: 'JiU', | ||
}, | ||
{ | ||
start: 71, | ||
end: 74, | ||
tag: '지유', | ||
}, | ||
{ | ||
start: 75, | ||
end: 88, | ||
tag: 'Dreamcatcher', | ||
}, | ||
{ | ||
start: 89, | ||
end: 94, | ||
tag: '드림캐쳐', | ||
}, | ||
], | ||
urls: [ | ||
{ | ||
start: 95, | ||
end: 118, | ||
url: 'https://t.co/IRpqINac5X', | ||
expanded_url: | ||
'https://twitter.com/PaniclnTheCity/status/1564281755531722755/photo/1', | ||
display_url: 'pic.twitter.com/IRpqINac5X', | ||
media_key: '3_1564281751844884482', | ||
}, | ||
], | ||
}, | ||
author_id: '2539875322', | ||
public_metrics: { | ||
retweet_count: 160, | ||
reply_count: 4, | ||
like_count: 967, | ||
quote_count: 9, | ||
}, | ||
}, | ||
includes: { | ||
media: [ | ||
{ | ||
media_key: '3_1564281751844884482', | ||
type: 'photo', | ||
url: 'https://pbs.twimg.com/media/FbVx9yNXEAIhA9O.jpg', | ||
}, | ||
], | ||
users: [ | ||
{ | ||
profile_image_url: | ||
'https://pbs.twimg.com/profile_images/1534928249217851396/Mn95uof8_normal.jpg', | ||
name: 'tm ツ', | ||
username: 'PaniclnTheCity', | ||
id: '2539875322', | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters