lmfresneda / mention-hashtag Goto Github PK
View Code? Open in Web Editor NEWExtract mentions (@mention) or hashtags (#hashtag) from any text
License: MIT License
Extract mentions (@mention) or hashtags (#hashtag) from any text
License: MIT License
hi . right now it does n`t support utf-8 characters in text . ( cant tokenize them ) .
for example :
let text = " یک متن #فارسی و یکمم #En برای #تست همه چی !";
let hashtags = mentionHashtag(text,{ symbol: false, type: '#' });
the result is : [ 'یکمتن#فارسیویکمم#ENG' ]
The currect result should be : ['فارسی','تست','Eng']
can you change the regex to support utf-8 texts ?
thanks.
They would be useful for those of us using TS.
Here's the current definition I'm using:
declare module 'mention-hashtag' {
export enum ExtractionType {
MENTION = '@',
HASH_TAG = '#',
ALL = 'all',
}
export type ExtractionOptions = { type: ExtractionType; unique: boolean; symbol: boolean };
export type ExtractionResult = { mentions: string[]; hashtags: string[] };
function extract(text: string, options: ExtractionType.ALL): ExtractionResult;
function extract(
text: string,
options: ExtractionOptions | ExtractionType.MENTION | ExtractionType.HASH_TAG,
): string[];
export default extract;
}
I'm not sure if its the best approach, but it does the work. Are you OK with a PR for this?
Is it possible to support combined hashtags, without spaces?
For example: #tag1#tag2#tag3
must return: [tag1 , tag2 , tag3]
Current version returns an empty array for this.
Thanks
Any plans to support emoticon hashtags? #😄
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.